85 lines
7.7 KiB
Markdown
85 lines
7.7 KiB
Markdown
|
+++
|
||
|
title = "Bat understands varlink now"
|
||
|
date = 2019-02-07T07:04:47+00:00
|
||
|
+++
|
||
|
[Bat](https://github.com/sharkdp/bat) is a *cat(1)* clone with syntax highlighting and Git integration.
|
||
|
|
||
|
My pull request for varlink syntax coloring was accepted today :\-)
|
||
|
|
||
|
<!-- more -->
|
||
|
|
||
|
So, to display:
|
||
|
|
||
|
```varlink
|
||
|
# The Varlink Service Interface is provided by every varlink service. It
|
||
|
# describes the service and the interfaces it implements.
|
||
|
interface org.varlink.service
|
||
|
|
||
|
# Get a list of all the interfaces a service provides and information
|
||
|
# about the implementation.
|
||
|
method GetInfo() -> (
|
||
|
vendor: string,
|
||
|
product: string,
|
||
|
version: string,
|
||
|
url: string,
|
||
|
interfaces: []string
|
||
|
)
|
||
|
|
||
|
# Get the description of an interface that is implemented by this service.
|
||
|
method GetInterfaceDescription(interface: string) -> (description: string)
|
||
|
|
||
|
# The requested interface was not found.
|
||
|
error InterfaceNotFound (interface: string)
|
||
|
|
||
|
# The requested method was not found
|
||
|
error MethodNotFound (method: string)
|
||
|
|
||
|
# The interface defines the requested method, but the service does not
|
||
|
# implement it.
|
||
|
error MethodNotImplemented (method: string)
|
||
|
|
||
|
# One of the passed parameters is invalid.
|
||
|
error InvalidParameter (parameter: string)
|
||
|
```
|
||
|
|
||
|
it will look like this:
|
||
|
|
||
|
<pre style="background-color: black;color: white"><b>$</b> bat org.varlink.service.varlink
|
||
|
<font color="#444444">───────┬───────────────────────────────────────────────────────────────────────────────</font>
|
||
|
<font color="#444444">│ </font>File: <b>org.varlink.service.varlink</b>
|
||
|
<font color="#444444">───────┼───────────────────────────────────────────────────────────────────────────────</font>
|
||
|
<font color="#444444"> 1</font> <font color="#444444">│</font> <font color="#75715E"># The Varlink Service Interface is provided by every varlink service. It</font>
|
||
|
<font color="#444444"> 2</font> <font color="#444444">│</font> <font color="#75715E"># describes the service and the interfaces it implements.</font>
|
||
|
<font color="#444444"> 3</font> <font color="#444444">│</font> <font color="#66D9EF">interface</font><font color="#F8F8F2"> </font><font color="#A6E22E">org.varlink.service</font>
|
||
|
<font color="#444444"> 4</font> <font color="#444444">│</font>
|
||
|
<font color="#444444"> 5</font> <font color="#444444">│</font> <font color="#75715E"># Get a list of all the interfaces a service provides and information</font>
|
||
|
<font color="#444444"> 6</font> <font color="#444444">│</font> <font color="#75715E"># about the implementation.</font>
|
||
|
<font color="#444444"> 7</font> <font color="#444444">│</font> <font color="#66D9EF">method</font><font color="#F8F8F2"> </font><font color="#A6E22E">GetInfo</font><font color="#F8F8F2">() </font><font color="#F92672">-> </font><font color="#F8F8F2">(</font>
|
||
|
<font color="#444444"> 8</font> <font color="#444444">│</font> <font color="#F8F8F2"> </font><font color="#FD971F">vendor</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">,</font>
|
||
|
<font color="#444444"> 9</font> <font color="#444444">│</font> <font color="#F8F8F2"> </font><font color="#FD971F">product</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">,</font>
|
||
|
<font color="#444444"> 10</font> <font color="#444444">│</font> <font color="#F8F8F2"> </font><font color="#FD971F">version</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">,</font>
|
||
|
<font color="#444444"> 11</font> <font color="#444444">│</font> <font color="#F8F8F2"> </font><font color="#FD971F">url</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">,</font>
|
||
|
<font color="#444444"> 12</font> <font color="#444444">│</font> <font color="#F8F8F2"> </font><font color="#FD971F">interfaces</font><font color="#F8F8F2">: </font><font color="#F92672">[]</font><font color="#66D9EF">string</font>
|
||
|
<font color="#444444"> 13</font> <font color="#444444">│</font> <font color="#F8F8F2">)</font>
|
||
|
<font color="#444444"> 14</font> <font color="#444444">│</font>
|
||
|
<font color="#444444"> 15</font> <font color="#444444">│</font> <font color="#75715E"># Get the description of an interface that is implemented by this service.</font>
|
||
|
<font color="#444444"> 16</font> <font color="#444444">│</font> <font color="#66D9EF">method</font><font color="#F8F8F2"> </font><font color="#A6E22E">GetInterfaceDescription</font><font color="#F8F8F2">(</font><font color="#FD971F">interface</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">) </font><font color="#F92672">-> </font><font color="#F8F8F2">(</font><font color="#FD971F">description</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">)</font>
|
||
|
<font color="#444444"> 17</font> <font color="#444444">│</font>
|
||
|
<font color="#444444"> 18</font> <font color="#444444">│</font> <font color="#75715E"># The requested interface was not found.</font>
|
||
|
<font color="#444444"> 19</font> <font color="#444444">│</font> <font color="#66D9EF">error</font><font color="#F8F8F2"> </font><font color="#A6E22E">InterfaceNotFound</font><font color="#F8F8F2"> (</font><font color="#FD971F">interface</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">)</font>
|
||
|
<font color="#444444"> 20</font> <font color="#444444">│</font>
|
||
|
<font color="#444444"> 21</font> <font color="#444444">│</font> <font color="#75715E"># The requested method was not found</font>
|
||
|
<font color="#444444"> 22</font> <font color="#444444">│</font> <font color="#66D9EF">error</font><font color="#F8F8F2"> </font><font color="#A6E22E">MethodNotFound</font><font color="#F8F8F2"> (</font><font color="#FD971F">method</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">)</font>
|
||
|
<font color="#444444"> 23</font> <font color="#444444">│</font>
|
||
|
<font color="#444444"> 24</font> <font color="#444444">│</font> <font color="#75715E"># The interface defines the requested method, but the service does not</font>
|
||
|
<font color="#444444"> 25</font> <font color="#444444">│</font> <font color="#75715E"># implement it.</font>
|
||
|
<font color="#444444"> 26</font> <font color="#444444">│</font> <font color="#66D9EF">error</font><font color="#F8F8F2"> </font><font color="#A6E22E">MethodNotImplemented</font><font color="#F8F8F2"> (</font><font color="#FD971F">method</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">)</font>
|
||
|
<font color="#444444"> 27</font> <font color="#444444">│</font>
|
||
|
<font color="#444444"> 28</font> <font color="#444444">│</font> <font color="#75715E"># One of the passed parameters is invalid.</font>
|
||
|
<font color="#444444"> 29</font> <font color="#444444">│</font> <font color="#66D9EF">error</font><font color="#F8F8F2"> </font><font color="#A6E22E">InvalidParameter</font><font color="#F8F8F2"> (</font><font color="#FD971F">parameter</font><font color="#F8F8F2">: </font><font color="#66D9EF">string</font><font color="#F8F8F2">)</font>
|
||
|
<font color="#444444">───────┴───────────────────────────────────────────────────────────────────────────────</font>
|
||
|
</pre>
|
||
|
|
||
|
|
||
|
|