cmd-help-sublime-syntax icon indicating copy to clipboard operation
cmd-help-sublime-syntax copied to clipboard

Sublime Syntax definition for sharkdp/bat to colorize command --help messages.

cmd-help.sublime-syntax

Sublime Syntax definition for bat to colorize command --help messages.

It provides just enough color to help find your way around a help message.

Example usage of the cmd-help syntax on 'bat -h'

See examples from other help messages.

Table of Contents

  • Installation
  • Configuration
    • Streamline it
    • bat theme support
  • Contributing
  • License

Installation

This syntax is included with bat since version 0.21.0.

If you have an older version of bat or you want the latest version of cmd-help, you can add it as a new syntax. You should copy this file.

To check that everything works, run git --help | bat -plhelp

Configuration

Streamline it

You may want to put an alias plus a function around this in your .bashrc/.zshrc/.*rc:

alias bathelp='bat --plain --language=cmd-help'
help() (
    set -o pipefail
    "$@" --help 2>&1 | bathelp
)

Then you can do help git. Or help git commit.

Depending on the command, help() will even handle alternative help options, e.g.: help bat -h.

If help() doesn't work with a command's alternative help option, you can still do CMD --help-option | bathelp.

bat theme support

The syntax works nicely with most bat themes. You can find examples of working themes here.

To use a different theme, just append --theme='<THEME_NAME>' to your bat commands. More info here.

You may also want to experiment with setting --italic-text=always. A few themes use italics on some elements, including Monokai.

Contributing

Contributions are welcome! :D

Make sure to give CONTRIBUTING.md a cursory read to learn how you can help.

If you want to hack on the project, look at the Development doc to help get you started.

If you like cmd-help, please star it on GitHub and spread the word. :)

License

MIT © Víctor González Prieto