mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-13 01:30:58 +01:00
93 lines
2.9 KiB
Markdown
93 lines
2.9 KiB
Markdown
# bat-extras
|
|
|
|
Bash scripts that integrate [bat](https://github.com/sharkdp/bat) with various command line tools.
|
|
|
|
|
|
|
|
## Scripts
|
|
|
|
### [`batgrep`](doc/batgrep.md)
|
|
Quickly search through and highlight files using [ripgrep](https://github.com/burntsushi/ripgrep).
|
|
<u>Requirements:</u> `ripgrep`
|
|
|
|
|
|
|
|
### [`batman`](doc/batman.md)
|
|
|
|
Read system manual pages (`man`) using `bat` as the manual page formatter.
|
|
|
|
|
|
|
|
### [`batwatch`](doc/batwatch.md)
|
|
|
|
Watch for changes in one or more files, and print them with `bat`.
|
|
<u>Requirements:</u> `entr` (optional)
|
|
|
|
|
|
|
|
### [`prettybat`](doc/prettybat.md)
|
|
|
|
Pretty-print source code and highlight it with `bat`.
|
|
<u>Requirements:</u> (see doc/prettybat.md)
|
|
|
|
|
|
|
|
## Installation via Package Manager
|
|
|
|
**Homebrew:** `brew install eth-p/software/bat-extras`
|
|
|
|
|
|
|
|
## Installation (![CircleCI](https://circleci.com/gh/eth-p/bat-extras.svg?style=svg))
|
|
|
|
The scripts in this repository are designed to run as-is, provided that they aren't moved around.
|
|
This means that you're free to just symlink `src/[script].sh` to your local bin folder.
|
|
|
|
If you would rather have self-contained scripts that you can place and run anywhere, you can use the `build.sh` script to create (and optionally install) them.
|
|
|
|
|
|
|
|
**Building:**
|
|
|
|
```bash
|
|
./build.sh [OPTIONS...]
|
|
```
|
|
|
|
This will combine and preprocess each script under the `src` directory, and create corresponding self-contained scripts in the `bin` folder. Any library scripts that are sourced using `source "${LIB}/[NAME].sh"` will be embedded automatically.
|
|
|
|
|
|
|
|
**Minification:**
|
|
|
|
There are three different options for minification:
|
|
|
|
| Option | Description |
|
|
| --------------- | ------------------------------------------------------ |
|
|
| `--minify=none` | Nothing will be minified. |
|
|
| `--minify=lib` | Embedded library scripts will be minified. \[default\] |
|
|
| `--minify=all` | Everything will be minified. |
|
|
|
|
This uses [shfmt](https://github.com/mvdan/sh) to perform minification.
|
|
|
|
|
|
|
|
|
|
**Installation:**
|
|
|
|
You can also specify `--install` and `--prefix=PATH` to have the build script automatically install the scripts for all users on the system. You may need to run the build script as root.
|
|
|
|
If you only want to install a single script, you can run the build process and copy the script directly out of the newly-created `bin` folder.
|
|
|
|
|
|
|
|
**Alternate Executable:**
|
|
|
|
Depending on the distribution, bat may have been renamed to avoid package conflicts.
|
|
If you wish to use these scripts on a distribution where this is the case, there is an `--alternate-executable=NAME` option which will build the scripts to use an alternate executable name.
|
|
|
|
|
|
|
|
**Verification:**
|
|
|
|
The build script will attempt to verify the correctness of the "bin" scripts by comparing their output with their source counterparts. It is recommended to let it do this, but you can disable verification with the `--no-verify` option.
|