Bat understands varlink now

Posted by Harald Hoyer on 7 February 2019

Bat is a cat(1) clone with syntax highlighting and Git integration.

My pull request for varlink syntax coloring was accepted today :-)

So, to display:

# 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:

$ bat org.varlink.service.varlink
───────┬───────────────────────────────────────────────────────────────────────────────
       File: org.varlink.service.varlink
───────┼───────────────────────────────────────────────────────────────────────────────
   1    # The Varlink Service Interface is provided by every varlink service. It
   2    # describes the service and the interfaces it implements.
   3    interface org.varlink.service
   4    
   5    # Get a list of all the interfaces a service provides and information
   6    # about the implementation.
   7    method GetInfo() -> (
   8      vendor: string,
   9      product: string,
  10      version: string,
  11      url: string,
  12      interfaces: []string
  13    )
  14    
  15    # Get the description of an interface that is implemented by this service.
  16    method GetInterfaceDescription(interface: string) -> (description: string)
  17    
  18    # The requested interface was not found.
  19    error InterfaceNotFound (interface: string)
  20    
  21    # The requested method was not found
  22    error MethodNotFound (method: string)
  23    
  24    # The interface defines the requested method, but the service does not
  25    # implement it.
  26    error MethodNotImplemented (method: string)
  27    
  28    # One of the passed parameters is invalid.
  29    error InvalidParameter (parameter: string)
───────┴───────────────────────────────────────────────────────────────────────────────