h is a consistent way to get help for Linux commands. When looking for command help, man is the typical go-to. But sometimes, you're looking for help for a subcommand or there is no man page available. In those cases, the --help flag is often used. Then, to make it scrollable, you might pipe the output to less. Now you're typing:
cargo build --help | lessThe aim of this project is to simplify this process.
h cargo buildA configuration file can be created at $XDG_CONFIG_HOME/h/config.toml (on Linux, this will typically be ~/.config/h/config.toml).
An alternate pager can be used.
pager = "/usr/bin/nvimpager"Some programs do not use a --help flag and instead have a help subcommand or some other alternative (e.g. Go). In those cases, a wrapper can be used which will prepend the search term with the necessary subcommand.
Adding this to config.toml:
[[wrappers]]
cmd = "go (.*)"
replacement = "go help {1}"
use_pager = trueWill run:
go help build | $PAGERcmd: Is a regex which accepts capture groups (anything inside parenthesis)replacement: A string to replace the search arguments. A number inside curly braces will be replaced by the corresponding capture group. Capture groups are numbered starting with 1.use_pager: Pipe the output of the resulting command to the$PAGERor the configured pager.use_stderr: By default, stdout is used when piping to the pager. This uses stderr instead.