Bash scripts that integrate bat with various command line tools.
Go to file
2020-05-02 14:57:59 -07:00
.circleci ci: Update CI config.yml to install SSH along with git 2020-04-27 18:51:36 -07:00
.test-framework@45ab0c1429 test: Update test framework to fix on Bash 3.2 2020-05-02 14:54:04 -07:00
doc docs: Change markdown that may be parsed incorrectly 2020-05-02 01:32:00 -07:00
lib lib: Fix issue when pagers read an empty argument as a file 2020-05-01 23:03:59 -07:00
src lib: Remove opt_hooks.sh and edit scripts to source lib files directly 2020-04-30 22:11:36 -07:00
test test: Update tests to shim stty instead of tput 2020-04-30 21:47:59 -07:00
.gitignore Format with vs-shell-format 2020-04-01 02:55:41 +02:00
.gitmodules Format with vs-shell-format 2020-04-01 02:55:41 +02:00
banner.txt developer: Add copyright/info banner to compressed scripts 2020-04-16 23:41:06 -07:00
build.sh developer: Update build.sh to remove redundant copyright comments 2020-04-30 22:06:11 -07:00
CONTRIBUTING.md docs: Add CONTRIBUTING.md 2020-04-27 01:45:14 -07:00
LICENSE.md Added license. 2019-06-19 14:41:20 -07:00
README.md docs: Update README to mention that compiled scripts are faster 2020-04-27 19:10:22 -07:00
release.sh developer: Update release script for improved release description 2020-04-30 21:37:08 -07:00
test.sh test: Fix argument values given to test.sh not being passed to Best 2020-04-27 18:51:36 -07:00
version.txt developer: Bump version 2020-05-02 14:57:59 -07:00

bat-extras

Bash scripts that integrate bat with various command line tools.

 

Scripts

batgrep

Quickly search through and highlight files using ripgrep. Requirements: ripgrep

batman

Read system manual pages (man) using bat as the manual page formatter.

batwatch

Watch for changes in one or more files, and print them with bat. Requirements: entr (optional)

batdiff

Diff a file against the current git index, or display the diff between two files. Requirements: bat, delta (optional)

prettybat

Pretty-print source code and highlight it with bat. Requirements: (see doc/prettybat.md)

 

Installation via Package Manager

Homebrew: brew install eth-p/software/bat-extras

 

Installation (CircleCI)

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 faster, self-contained scripts that you can place and run anywhere, you can use the build.sh script to create (and optionally install) them.

 

Building:

./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 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.

 

Contributing

If you would like to contribute to bat-extras, please feel free to open an issue on GitHub, or make a pull request. If you do the latter, please keep our contributing guidelines in mind.