1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-10-30 06:33:59 +00:00

Syntax: add cmd-help (#2148)

* Add cmd-help syntax

To highlight command --help messages.

* README.md: mention help message highlighting

* README.md: edit help message highlighting
This commit is contained in:
Víctor González Prieto
2022-04-26 19:42:18 +02:00
committed by GitHub
parent 3239d3be2a
commit b0898900ce
6 changed files with 133 additions and 0 deletions

View File

@@ -212,6 +212,24 @@ Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145)
The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) script is a wrapper that will format code and print it with `bat`.
#### Highlighting `--help` messages
You can use `bat` to colorize help text: `$ cp --help | bat -plhelp`
You can also use a wrapper around this:
```bash
# in your .bashrc/.zshrc/*rc
alias bathelp='bat --plain --language=help'
help() {
"$@" --help 2>&1 | bathelp
}
```
Then you can do `$ help cp` or `$ help git commit`.
Please report any issues with the help syntax in [this repository](https://github.com/victor-gp/cmd-help-sublime-syntax).
## Installation