Added script for using bat with man

This commit is contained in:
Ethan P 2019-09-07 15:19:12 -07:00
parent 369d7f4eef
commit 85bb5f8bed
No known key found for this signature in database
GPG Key ID: 1F8DF8091CD46FBC
3 changed files with 51 additions and 0 deletions

View File

@ -7,6 +7,7 @@ Bash scripts that integrate [bat](https://github.com/sharkdp/bat) with various c
## Scripts
- [`batgrep`](doc/batgrep.md) (ripgrep + bat)
- [`batman`](doc/batman.md) (man with bat)
- [`prettybat`](doc/prettybat.md) (pretty printing + bat)
 

30
doc/batman.md Normal file
View File

@ -0,0 +1,30 @@
# bat-extras: batman
A script that allows bat to be used as a manual highlighter.
## Command Line
**Synopsis:**
- `batman [SECTION] [ENTRY] `
## Caveats
None so far.
## Acknowledgements
Thanks to [@sharkdp](https://github.com/sharkdp) and [@LunarLambda](https://github.com/LunarLambda) for debugging how to make this work properly in [certain environments](https://github.com/sharkdp/bat/issues/652).
## Issues?
If you find an issue or have a feature suggestion, make a pull request or issue through GitHub!
Contributions are always welcome.

20
src/batman.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# bat-extras | Copyright (C) 2019 eth-p | MIT License
#
# Repository: https://github.com/eth-p/bat-extras
# Issues: https://github.com/eth-p/bat-extras/issues
# -----------------------------------------------------------------------------
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../lib"
source "${LIB}/print.sh"
source "${LIB}/opt.sh"
source "${LIB}/version.sh"
# -----------------------------------------------------------------------------
export MANPAGER='sh -c "col -bx | bat --language man --style grid"'
export MANROFFOPT='-c'
export BAT_PAGER="$PAGER"
command man "$@"
exit $?