Giter VIP home page Giter VIP logo

bat-extras's Introduction

bat-extras

Bash scripts that integrate bat with various command line tools.

 

Scripts

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

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

A less (and soon bat) preprocessor for viewing more types of files in the terminal.

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

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

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

 

Installation via Package Manager

Homebrew

All of the bat-extras scripts can be installed with brew install bat-extras.

If you would prefer to only install the specific scripts you need, you can use the eth-p/software tap to install individual scripts: brew install eth-p/software/bat-extras-[SCRIPT]

MacPorts

The bat-extras scripts can also be installed via MacPorts on macOS:

sudo port install bat-extras

Port info here.

Pacman

bat-extras is officially available on the Arch extra repository!

If you have the extra repository enabled, you can install bat-extras by running:

pacman -S bat-extras

Gentoo

bat-extras is available on Gentoo's Guru Overlay as sys-apps/bat-extras.

To install, first make sure you've added the Gentoo Guru Overlay to your local repositories, then emerge accordingly...

emerge sys-apps/bat-extras

Fedora (Unofficial)

bat-extras is available in an unofficial Fedora Copr repository. Note: this package does not contain prettybat since prettier is not yet packaged for Fedora.

Install the Copr plugin, enable the repository, and then install the package by running:

dnf install dnf-plugins-core 
dnf copr enable awood/bat-extras
dnf install bat-extras

 

Installation

Test

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.

Manuals:

The build script will automatically generate a man page for each of the markdown documentation files. This is a beta feature that uses a non-compliant Markdown "parser" written in Bash, and there is no guarantee towards the quality of the generated manual pages. If you do not want to generate manual files, you can provide the --no-manuals option to disable manual file generation.

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.

You may also specify alternate executables for ripgrep, delta, fzf, or git with --alternate-executable:PROGRAM NAME where PROGRAM is one the aforementioned programs. Note that doing so may cause verification to fail.

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.

bat-extras's People

Contributors

alissa-huskey avatar amorymeltzer avatar aspiers avatar awood avatar eth-p avatar felixonmars avatar happyearthbytes avatar harrisonmcculloughromaric avatar herbygillot avatar jtraub avatar llimllib avatar mithicspirit avatar nezteb avatar rexackermann avatar salacio avatar telotortium avatar tleibert avatar ucodery avatar verytastytomato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bat-extras's Issues

awk errors when running `build.sh`

So I downloaded bat-extras by cloning into my home directory. Afterwards, I ran ./build.sh without any options (and not having shfmt)

I got the following error messages:

Verifying scripts...
Submodule 'best' (https://github.com/eth-p/best.git) registered for path '.test-framework'
Cloning into '/home/pepoluan/Downloads/bat-extras/.test-framework'...
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
Verified successfully.

The 'built' files do appear in the bin/ directory, and a quick test of them seems to indicate they all working as expected.

Is this normal?

MacOS: batgrep tests fail

MacOS Catalina 10.15.4, bash. bat-0.13.0. Current master of this repo.

$ ./test.sh 
--------------------------------------------------------------------------------------------
| Test Suite: batgrep                                                                      |
--------------------------------------------------------------------------------------------
[FAIL] option_context       :: Exited with code 2.
[FAIL] output_with_color    :: Exited with code 2.
[FAIL] output_without_color :: Exited with code 2.
[FAIL] regular_file         :: Exited with code 2.
[FAIL] search_fixed         :: Exited with code 2.
[FAIL] search_regex         :: Exited with code 2.
[FAIL] symlink_file         :: Exited with code 2.

Totals:
    PASS: 0 / 7
    FAIL: 7 / 7
--------------------------------------------------------------------------------------------
| Test Suite: lib_opt                                                                      |
--------------------------------------------------------------------------------------------
[PASS] long                 :: 20 ms
[PASS] long_value_explicit  :: 20 ms
[PASS] long_value_implicit  :: 25 ms
[PASS] short_value_explicit :: 28 ms
[PASS] short_value_implicit :: 21 ms

Totals:
    PASS: 5 / 5
    FAIL: 0 / 5

ALL TESTS PASSED.
--------------------------------------------------------------------------------------------
| Test Suite: lib_version                                                                  |
--------------------------------------------------------------------------------------------
[PASS] compare_eq           :: 22 ms
[PASS] compare_ge           :: 23 ms
[PASS] compare_gt           :: 27 ms
[PASS] compare_le           :: 27 ms
[PASS] compare_lt           :: 25 ms
[PASS] compare_ne           :: 28 ms

Totals:
    PASS: 6 / 6
    FAIL: 0 / 6

ALL TESTS PASSED.

batwatch syntax error

It seems that using batwatch on any file with a timestamp results in a syntax problem:

$ batwatch /var/log/pacman.log
/usr/bin/batwatch: line 449: [[: 2020-03-23 11:20:33.584328650 -0700: syntax error in expression (error token is "11:20:33.584328650 -0700")

Scripts don't tokenize PAGER environment variable properly.

Original issue:

lilyball 6 hours ago
This won't actually tokenize like the shell does (and like bat does), it merely splits on IFS. That's certainly better than before as it will handle less -R, but it won't handle e.g. foo "one two".

Using read -d '' -a SCRIPT_PAGER_CMD <<<"$PAGER" would at least handle backslash escapes (including escaped spaces), but still wouldn't handle quotes.

I'm not sure if bash actually has any way of truly parsing it with quotes outside of using something like eval "SCRIPT_PAGER_CMD=($PAGER)", but that's trivial to break out of with a stray ), and it also does a bunch of substitution that bat`'s tokenization doesn't do (e.g. variable substitution, tilde substitution, etc).

Ultimately, splitting on IFS is better than nothing. Though the read approach would at least allow for some escaping (with backslashes).

This might be able to be done with awk and a read loop.

Batgrep doesn't work with ripgrep < 12.0.0

With rg 11.x.x, running batgrep causes the following error:

   1 │ error: Found argument '--no-context-separator' which wasn't expected, or isn't valid in this context
   2 │     Did you mean --context-separator?
   3 │ 
   4 │ USAGE:
   5 │     
   6 │     rg [OPTIONS] PATTERN [PATH ...]
   7 │     rg [OPTIONS] [-e PATTERN ...] [-f PATTERNFILE ...] [PATH ...]
   8 │     rg [OPTIONS] --files [PATH ...]
   9 │     rg [OPTIONS] --type-list
  10 │     command | rg [OPTIONS] PATTERN
  11 │ 
  12 │ For more information try --help
  13 │ 

Originally posted by @faisal-shah in #43 (comment)

Invalid symlink

The following line doesn't work when batman.sh is symlinked.

LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../lib"

If we change the former to:

LIB="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/../lib"

LIB will be set to the "real" src directory.

Do you want me to open a PR?

batgrep error with linux pipe

$ batgrep --version
batgrep 2020.10.05
$ bat -V
bat 0.16.0
$ cat setproxy.sh
export https_proxy=http://172.17.18.80:8080
export http_proxy=http://172.17.18.80:8080
export ftp_proxy=http://172.17.18.80:8080
$ cat setproxy.sh |batgrep http
────────────────────────────────────────────────────────────────────────────────
[bat error]: '<stdin>': No such file or directory (os error 2)
────────────────────────────────────────────────────────────────────────────────

Pager functionality breaks if PAGER contains arguments

The PAGER env var is usually treated like a shell command, so it can be written like less -R. Unfortunately, bat-extras treats it like an executable, so PAGER='less -R' breaks. For batgrep and batwatch it produces an error message, and for batman it just disables paging (because bat handles garbage pagers by disabling paging, and the script is passing BAT_PAGER='less\ -R' to it). prettybat is the only one that works, because it doesn't touch the pager at all and falls back to bat's built-in behavior.

Incidentally, I have no idea why batman constructs a BAT_PAGER env var instead of just using bat's built-in behavior.

prettybat can't read from pipe

When trying to preview a remote file (e.g. an installer shell script) I'd like to be able to fetch a file from a server with curl and pipe the result to prettybat. This works fine when using just bat for the syntax highlighting, but prettybat either doesn't seem to support that use case or needs to be fixed.

$ curl https://sh.rustup.rs | prettybat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0[prettybat error]: -: No such file or directory
 85 18636   85 15971    0     0   318k      0 --:--:-- --:--:-- --:--:--  318k
curl: (23) Failure writing output to destination

It would be nice if this could be supported.

batman: same behavior as man after close

Is there some way to configure batman to act the same as man (and less, I guess) after closing? Here's a screen recording to show what I mean:

Peek 2019-12-03 13-23

After closing, man sort of cleans up after itself so the terminal just goes back to the way it was before.

Allow batgrep to page results

batgrep is great, but I miss the option to page the results. I usually go back to using rg -p foo | bat but it's not ideal since I can't use syntax highlight.

Maybe we could pass-trough the --paging option to bat?

Great tools, btw!

batgrep: "no pattern provided"

I can't seem to get batgrep to work correctly, as I always get this error message:

▶ bin/batgrep foo
batgrep: no pattern provided

My bash version is

GNU bash, Version 5.0.7(1)-release (x86_64-pc-linux-gnu)

I am using bat 0.12.1 and ripgrep 0.10.0

doc/prettybat.md: Caveats section seems to be out of date

The header displayed by bat will show STDIN instead of the filename.

This no longer appears to be true in my tests, and there is a PRINT_ARGS+=("--file-name" "$1") line in prettybat.sh.

(I didn't open a PR because, for all I know, I just haven't tested it thoroughly enough to catch the problem situation.)

Build option to specify the bat executable name/path.

Some systems might not have bat as the default name for the bat executable.
The name is already used by a different package in Debian, and the bat executable will be renamed in the upstream Debian package repository.

An option to specify the name/path of the bat executable should be added to the build script.

Prettybat doesn't show the file name.

Due to the way the header component in bat is implemented, it will always display "STDIN" as the file name when reading from the standard input stream. This isn't ideal when we're trying to display the contents of an existing file that has been piped (e.g. prettier file.sh | bat).

One possible workaround would be to create a file or named pipe in a temporary directory, but this is a hacky workaround at best.

Right now, it's best to wait on sharkdp/bat#654.

Current master has test failures on NixOS

Current master (fb97300) passes the test suite on macOS with Bash 4.4.23, but when run on NixOS with the same bash version, I get failures in lib_dsl and batgrep.

Test suite: batgrep
----------------------------------------------------------------------------------------------------------------------------------------
| Test Suite: batgrep                                                                                                                  |
----------------------------------------------------------------------------------------------------------------------------------------
[FAIL] option_context       :: Mismatched STDOUT snapshot.                                                                              
[FAIL] output_with_color    :: Mismatched STDOUT snapshot.                                                                              
[FAIL] output_without_color :: Mismatched STDOUT snapshot.                                                                              
[FAIL] regular_file         :: Mismatched STDOUT snapshot.          
[FAIL] search_fixed         :: Mismatched STDOUT snapshot.          
[FAIL] search_regex         :: Mismatched STDOUT snapshot.          
[FAIL] symlink_file         :: Mismatched STDOUT snapshot.          
[PASS] version              :: 97 ms                                                                                                    
                                                                                                                                        
Totals:                                                                                                                                 
    PASS: 1 / 8                                                     
    FAIL: 7 / 8                                                     
Test suite: lib_dsl
----------------------------------------------------------------------------------------------------------------------------------------
| Test Suite: lib_dsl                                                                                                                  |
----------------------------------------------------------------------------------------------------------------------------------------
[FAIL] parse_command        :: Expectation failed: [ 0 args = 1 args ]                                                                  
[FAIL] parse_escaped_args   :: Expectation failed: [ 0 args = 4 args ]                                                                  
[FAIL] parse_option         :: Expectation failed: [ 0 args = 4 args ]                                                                  
[FAIL] parse_quoted_args    :: Expectation failed: [ 0 args = 4 args ]                                                                  
[FAIL] parse_simple_args    :: Expectation failed: [ 0 args = 4 args ]                                                                  
                                                                    
Totals:                                                             
    PASS: 0 / 5                                                     
    FAIL: 5 / 5                                                     

lib_dsl failures appear to be because /usr/bin/awk doesn't exist. It should just be using awk instead, as awk is not guaranteed to exist in /usr/bin.

Current master fails script verification when building on macOS

Current master (5af706f) fails to verify scripts when building. Running ./test.sh works but the verify step is running into a lot of issues:

Verifying scripts...
batgrep:version failed.
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//41422.async_.report.complete: No such file or directory
batwatch:versionmv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42013.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42013.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42013.async_.report: mv: No such file or directory
/var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42013.async_.report: No such file or directory
lib_dsl:parse_simple_argsmv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42120.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42120.async_.report.complete: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42120.async_.report: No such file or directory
mv: mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42120.async_.report/var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42120.async_.report: : No such file or directory
No such file or directory
lib_opt:short_value_implicitmv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report: No such file or directory
lib_pager:less_versionmv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42226.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42521.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42521.async_.report.complete: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42521.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42521.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42521.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42521.async_.report: No such file or directory
perf:perf_lib_opt_hook_widthmv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report.complete: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report: No such file or directory
mv: /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report.complete: No such file or directory
mv: rename /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report to /var/folders/cs/l6c6g06x0974_0w5pdg8dps80000gn/T//42636.async_.report.complete: No such file or directory
One or more tests failed.
Run ./test.sh for more detailed information.

The mv spam seems to be a consequence of parallelization, as I get it with ./test.sh --jobs=8 as well. However even ./test.sh --compiled --porcelain --jobs=8 seems to reporting all the tests pass (ignoring the mv error spam) so I'm not sure why it's reporting test failures when running this after building.

batman: bad highlighting when BAT_THEME is set

When the BAT_THEME is set to something different than the default batman does not do meaningful syntax highlighting.

Screenshots:
When BAT_THEME is default (or not set):
image

When BAT_THEME is set (in the screenshot to 'base16'):
image

Feature request to take `MANPAGER` env var over `BAT_PAGER` for `batman`

(Context: I'm taking you up on your suggestion from #6 )

It is convenient to be able to bat out a file to the screen and then see it for the next command, however, it is convenient to be able to view a man page and then close it and see the history of all commands typed before, so the console would look like this:

2020-01-25 22:05:21 at 1593 as root@<hostname> in ~
# man ls

2020-01-25 22:05:26 at 1594 as root@<hostname> in ~
# man man

2020-01-25 22:05:36 at 1595 as root@<hostname> in ~
# man less

If batman could consider MANPAGER (if present) over BAT_PAGER, this would allow both (1) traditional cating of files to the screen for reference in typing of the next command and (2) traditional viewing and closing of man pages.

batgrep: options in RIPGREP_CONFIG_PATH break batgrep

If you do the following from the source code directory:

export RIPGREP_CONFIG_PATH=/tmp/rpconfig
echo '--context=3' > $RIPGREP_CONFIG_PATH
batgrep min

You'll get the following output:

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[bat error]: Empty line range
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[bat error]: Empty line range
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[bat error]: Empty line range
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     File: README.md
  70 | Option          | Description                                            |
  71 | --------------- | ------------------------------------------------------ |
  72 | `--minify=none` | Nothing will be minified.                              |
  73 | `--minify=lib`  | Embedded library scripts will be minified. \[default\] |
  74 | `--minify=all`  | Everything will be minified.                           |
  75
  76 This uses [shfmt](https://github.com/mvdan/sh) to perform minification.
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[bat error]: Empty line range
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/usr/local/bin/batgrep: line 460: //github.com/mvdan/sh) to perform minification.: syntax error: operand expected (error token is "//github.com/mvdan/sh) to perform minification.")
# This works, however:
env -u RIPGREP_CONFIG_PATH batgrep --context=3 minify

batgrep|batpipe keyword search/highlight looks bad

Hi Team,

I am using batgrep for keyward search in file and output rendering i feel is not prettier and i feel can be better. Please help me if we can address this with some config tweak. batpipe also instead of using less as pager working like cat application and processing all content in one go making screen unresponsive due to rendering or huge file.

image
Please help me to know how we can correct this rendering.

-Praveen

Installing via Homebrew on Linux (Fedora 33) fails when building clang-format

Trying to install via Homebrew on Fedora 33:

  • Run : brew install eth-p/software/bat-extras
✖ 1 ❯ brew install eth-p/software/bat-extras
==> Installing bat-extras from eth-p/software
==> Downloading https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang-11.1.0.src.tar.xz
Already downloaded: /home/taran/.cache/Homebrew/downloads/0f0654e2d8309e4ba14b521beec1e77ee923109aacf625fe78892534d100ed96--clang-11.1.0.src.tar.xz
==> Downloading https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/llvm-11.1.0.src.tar.xz
Already downloaded: /home/taran/.cache/Homebrew/downloads/d56622798d31d26fc5b8f6eeb967b4dfc6dd7948ce5649af87e5257d378f4823--llvm-11.1.0.src.tar.xz
==> Downloading https://github.com/eth-p/bat-extras/archive/v2020.10.05.tar.gz
Already downloaded: /home/taran/.cache/Homebrew/downloads/d2663ff24a3e7f4cf98fe0e177d1395b6e723f8cbc0f388b7ccb080f1018d0e1--bat-extras-2020.10.05.tar.gz
==> Installing dependencies for eth-p/software/bat-extras: clang-format
==> Installing eth-p/software/bat-extras dependency: clang-format
==> cmake -G Ninja -DLLVM_EXTERNAL_PROJECTS="clang" ..
==> ninja clang-format
Last 15 lines from /home/taran/.cache/Homebrew/Logs/clang-format/02.ninja:
[683/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOptionDocEmitter.cpp.o
[684/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
FAILED: tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/g++-5 -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/utils/TableGen -I../tools/clang/utils/TableGen -I../tools/clang/include -Itools/clang/include -I/home/linuxbrew/.linuxbrew/include/libxml2 -Iinclude -I../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -DNDEBUG  -fno-exceptions -fno-rtti -std=c++14 -MD -MT tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o -MF tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o.d -o tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o -c ../tools/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
g++-5: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/linuxbrew-core/issues> for instructions.
[685/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o
[686/1124] Linking CXX static library lib/libLLVMAnalysis.a
[687/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o
[688/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangAttrEmitter.cpp.o
[689/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o
[690/1124] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o
ninja: build stopped: subcommand failed.

READ THIS: https://docs.brew.sh/Troubleshooting

Will try --without-clang-format, but would be nice to just be able to install the default.

Testing fails, despite tests don't fail.

When running ./build.sh, after all jobs have finished, verifying the scripts won't:

Verifying scripts...
batdiff:version failed.
batgrep:option_context failed.
batgrep:output_with_color failed.
batgrep:output_without_color failed.
batgrep:regular_file failed.
batgrep:search_fixed failed.
batgrep:search_from_stdin failed.
batgrep:search_regex failed.
batgrep:symlink_file failed.
batgrep:version failed.
batman:version failed.
batwatch:displayed failed.
batwatch:help failed.
batwatch:version failed.
prettybat:version failed.
One or more tests failed.
Run ./test.sh for more detailed information.

Following the suggested course of action by running ./test.sh yields:

--------------------------------------------
| Test Suite: batdiff                      |
--------------------------------------------
[PASS] version              :: 56 ms

Totals:
    PASS: 1 / 1
    FAIL: 0 / 1

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: batgrep                      |
--------------------------------------------
[PASS] option_context       :: 96 ms
[PASS] output_with_color    :: 89 ms
[PASS] output_without_color :: 90 ms
[PASS] regular_file         :: 95 ms
[PASS] search_fixed         :: 90 ms
[PASS] search_from_stdin    :: 93 ms
[PASS] search_regex         :: 99 ms
[PASS] symlink_file         :: 94 ms
[PASS] version              :: 59 ms

Totals:
    PASS: 9 / 9
    FAIL: 0 / 9

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: batman                       |
--------------------------------------------
[PASS] version              :: 34 ms

Totals:
    PASS: 1 / 1
    FAIL: 0 / 1

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: batwatch                     |
--------------------------------------------
[PASS] displayed            :: 210 ms
[PASS] help                 :: 56 ms
[PASS] version              :: 45 ms

Totals:
    PASS: 3 / 3
    FAIL: 0 / 3

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: lib_dsl                      |
--------------------------------------------
[PASS] parse_command        :: 5 ms
[PASS] parse_escaped_args   :: 6 ms
[PASS] parse_option         :: 9 ms
[PASS] parse_quoted_args    :: 6 ms
[PASS] parse_simple_args    :: 6 ms

Totals:
    PASS: 5 / 5
    FAIL: 0 / 5

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: lib_opt                      |
--------------------------------------------
[PASS] fn_resetargs         :: 2 ms
[PASS] fn_setargs           :: 2 ms
[PASS] hook                 :: 4 ms
[PASS] long                 :: 3 ms
[PASS] long_explicit        :: 3 ms
[PASS] long_implicit        :: 2 ms
[PASS] short                :: 3 ms
[PASS] short_conv_explicit  :: 3 ms
[PASS] short_conv_implicit  :: 3 ms
[PASS] short_conv_none      :: 3 ms
[PASS] short_default        :: 3 ms
[PASS] short_default_mode   :: 2 ms
[PASS] short_explicit       :: 3 ms
[PASS] short_implicit       :: 3 ms
[PASS] short_pass_explicit  :: 3 ms
[PASS] short_pass_implicit  :: 3 ms
[PASS] short_pass_none      :: 4 ms
[PASS] short_split_explicit :: 4 ms
[PASS] short_split_implicit :: 4 ms
[PASS] short_split_none     :: 4 ms
[PASS] short_value_explicit :: 3 ms
[PASS] short_value_implicit :: 3 ms
[PASS] short_value_none     :: 3 ms

Totals:
    PASS: 23 / 23
    FAIL: 0 / 23

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: lib_pager                    |
--------------------------------------------
[PASS] args_copied_from_bat_pager :: 7 ms
[PASS] args_copied_from_pager :: 17 ms
[PASS] env_bat_pager        :: 8 ms
[PASS] less_args            :: 36 ms
[PASS] less_args_not_less   :: 14 ms
[PASS] less_detection       :: 52 ms
[PASS] less_version         :: 36 ms

Totals:
    PASS: 7 / 7
    FAIL: 0 / 7

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: lib_version                  |
--------------------------------------------
[PASS] compare_eq           :: 5 ms
[PASS] compare_ge           :: 4 ms
[PASS] compare_gt           :: 5 ms
[PASS] compare_le           :: 4 ms
[PASS] compare_lt           :: 4 ms
[PASS] compare_ne           :: 4 ms

Totals:
    PASS: 6 / 6
    FAIL: 0 / 6

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: perf                         |
--------------------------------------------
[PASS] perf_baseline        :: 2 ms
[PASS] perf_lib_constants   :: 9 ms
[PASS] perf_lib_dsl         :: 2 ms
[PASS] perf_lib_opt         :: 11 ms
[PASS] perf_lib_opt_hook_color :: 2 ms
[PASS] perf_lib_opt_hook_pager :: 2 ms
[PASS] perf_lib_opt_hook_version :: 2 ms
[PASS] perf_lib_opt_hook_width :: 2 ms
[PASS] perf_lib_pager       :: 2 ms
[PASS] perf_lib_print       :: 9 ms
[PASS] perf_lib_str         :: 2 ms
[PASS] perf_lib_version     :: 2 ms

Totals:
    PASS: 12 / 12
    FAIL: 0 / 12

ALL TESTS PASSED.
--------------------------------------------
| Test Suite: prettybat                    |
--------------------------------------------
[PASS] version              :: 47 ms

Totals:
    PASS: 1 / 1
    FAIL: 0 / 1

ALL TESTS PASSED.

This differs from the interpretation during build. Might this be due to my shfmt being an alias, and having added it this way?

diff --git a/build.sh b/build.sh
index cc80c7f..8f5621c 100755
--- a/build.sh
+++ b/build.sh
@@ -14,6 +14,8 @@ LIB="$HERE/lib"
 source "${LIB}/print.sh"
 source "${LIB}/opt.sh"
 source "${LIB}/constants.sh"
+shopt -s expand_aliases
+alias shfmt="podman run --rm -v $PWD:/mnt:z -w /mnt mvdan/shfmt:latest-alpine"
 # -----------------------------------------------------------------------------
 set -eo pipefail
 exec 3>&1

Using --no-verify helps to work around the issue, but does not answer the question what could possibly go wrong here.

batgrep: support -S/--smart-case

As the subject states, I'd love to be able to use -S with batgrep, or better yet, support an env var or argument to pass through arbitrary additional args with the caveat that it mustn't change the output formatting.

zsh: parse error near `|'

batwatch can't be compiled.

## Input
zcompile batwatch

## Result
zsh: parse error near `|'
zcompile: can't read file: batwatch

batman test fails on Linux

Running the batman test suite fails on Linux with signal 141 (SIGPIPE). It appears that batman --version | head -n1 causes batman to fail on a printf call.

Invalid variable

When running ./build.sh on Fedora 33, the shell outputs an invalid variable name for line 312

constant_value="$(sed_escape "${!constant_name}")"

Removing the exclamation mark helped resolve the issue, and running the script as inteded.

Current master fails tests on use_shim with macOS bash (3.2.57)

Running the tests on current master (fb97300)fails on Bash 3.2.57 (what macOS ships with). For each test suite I get an error in grey (test runner?) aboutuse_shim: command not found, and then the test suite itself logs a bunch of errors about description: command not found` (I don't know if this is a consequence of use_shim missing, or is the same underlying cause, or what). Running them with Bash 4.4.23 instead works fine.

Output with bash 3.2.57
-----------------------------------------------------------------------------------------------------------
| Test Suite: batdiff                                                                                     |
-----------------------------------------------------------------------------------------------------------
/Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batdiff.sh: line 2: use_shim: command not found
FATAL ERROR: The test runner has crashed.
failed with exit code 127
-----------------------------------------------------------------------------------------------------------
| Test Suite: batgrep                                                                                     |
-----------------------------------------------------------------------------------------------------------
/Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 4: use_shim: command not found
[FAIL] option_context       :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 87: description: command not found
[FAIL] output_with_color    :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 47: description: command not found
[FAIL] output_without_color :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 57: description: command not found
[FAIL] regular_file         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 27: description: command not found
[FAIL] search_fixed         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 77: description: command not found
[FAIL] search_regex         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 67: description: command not found
[FAIL] symlink_file         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 37: description: command not found
[FAIL] version              :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batgrep.sh: line 18: description: command not found

Totals:
    PASS: 0 / 8
    FAIL: 8 / 8
-----------------------------------------------------------------------------------------------------------
| Test Suite: batman                                                                                      |
-----------------------------------------------------------------------------------------------------------
/Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batman.sh: line 2: use_shim: command not found
FATAL ERROR: The test runner has crashed.
failed with exit code 127
-----------------------------------------------------------------------------------------------------------
| Test Suite: batwatch                                                                                    |
-----------------------------------------------------------------------------------------------------------
/Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/batwatch.sh: line 2: use_shim: command not found
FATAL ERROR: The test runner has crashed.
failed with exit code 127
-----------------------------------------------------------------------------------------------------------
| Test Suite: lib_dsl                                                                                     |
-----------------------------------------------------------------------------------------------------------
[FAIL] parse_command        :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_dsl.sh: line 59: description: command not found
[FAIL] parse_escaped_args   :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_dsl.sh: line 83: description: command not found
[FAIL] parse_option         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_dsl.sh: line 92: description: command not found
[FAIL] parse_quoted_args    :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_dsl.sh: line 75: description: command not found
[FAIL] parse_simple_args    :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_dsl.sh: line 67: description: command not found

Totals:
    PASS: 0 / 5
    FAIL: 5 / 5
-----------------------------------------------------------------------------------------------------------
| Test Suite: lib_opt                                                                                     |
-----------------------------------------------------------------------------------------------------------
[FAIL] long                 :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_opt.sh: line 23: description: command not found
[FAIL] long_value_explicit  :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_opt.sh: line 50: description: command not found
[FAIL] long_value_implicit  :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_opt.sh: line 36: description: command not found
[FAIL] short_value_explicit :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_opt.sh: line 78: description: command not found
[FAIL] short_value_implicit :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_opt.sh: line 64: description: command not found

Totals:
    PASS: 0 / 5
    FAIL: 5 / 5
-----------------------------------------------------------------------------------------------------------
| Test Suite: lib_pager                                                                                   |
-----------------------------------------------------------------------------------------------------------
[FAIL] args_copied_from_bat_pager :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 94: description: command not found
[FAIL] args_copied_from_pager :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 86: description: command not found
[FAIL] env_bat_pager        :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 74: description: command not found
[FAIL] less_args            :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 44: description: command not found
[FAIL] less_args_not_less   :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 66: description: command not found
[FAIL] less_detection       :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 22: description: command not found
[FAIL] less_version         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_pager.sh: line 30: description: command not found

Totals:
    PASS: 0 / 7
    FAIL: 7 / 7
-----------------------------------------------------------------------------------------------------------
| Test Suite: lib_version                                                                                 |
-----------------------------------------------------------------------------------------------------------
[FAIL] compare_eq           :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_version.sh: line 6: description: command not found
[FAIL] compare_ge           :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_version.sh: line 56: description: command not found
[FAIL] compare_gt           :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_version.sh: line 36: description: command not found
[FAIL] compare_le           :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_version.sh: line 46: description: command not found
[FAIL] compare_lt           :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_version.sh: line 26: description: command not found
[FAIL] compare_ne           :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/lib_version.sh: line 16: description: command not found

Totals:
    PASS: 0 / 6
    FAIL: 6 / 6
-----------------------------------------------------------------------------------------------------------
| Test Suite: perf                                                                                        |
-----------------------------------------------------------------------------------------------------------
[FAIL] perf_baseline        :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 6: description: command not found
[FAIL] perf_lib_constants   :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 11: description: command not found
[FAIL] perf_lib_dsl         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 17: description: command not found
[FAIL] perf_lib_opt         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 23: description: command not found
[FAIL] perf_lib_opt_hook_color :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 29: description: command not found
[FAIL] perf_lib_opt_hook_pager :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 35: description: command not found
[FAIL] perf_lib_opt_hook_version :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 41: description: command not found
[FAIL] perf_lib_opt_hook_width :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 47: description: command not found
[FAIL] perf_lib_pager       :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 53: description: command not found
[FAIL] perf_lib_print       :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 59: description: command not found
[FAIL] perf_lib_str         :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 65: description: command not found
[FAIL] perf_lib_version     :: /Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/perf.sh: line 71: description: command not found

Totals:
    PASS: 0 / 12
    FAIL: 12 / 12
-----------------------------------------------------------------------------------------------------------
| Test Suite: prettybat                                                                                   |
-----------------------------------------------------------------------------------------------------------
/Users/lily/Dev/Nix/Scratch/bat-extras/test/suite/prettybat.sh: line 2: use_shim: command not found
FATAL ERROR: The test runner has crashed.
failed with exit code 127

batgrep will not output, line 198 "rg"

user:/ $ grep [11:54:16]
[batgrep error]: no pattern provided
user:
/ $ ls | grep test [11:54:18]
/usr/local/bin/batgrep.sh: line 198: rg: command not found
user:/ $ ps -aux | grep bat [11:54:27]
/usr/local/bin/batgrep.sh: line 198: rg: command not found
user:
/ $

[prettybat] Add SVG and XML support

SVG may not be too hard to add, since it should be supported with prettier --parser=html already.

XML support has not been mainlined in prettier yet, so that would need a different formatter, like e.g. tidy, but I haven't investigated enough to know what the best or most reasonable available XML formatter is currently. Not sure if that is something you would want to consider.

"batman" syntax error.

Hi, thank you for bat! its amazing!!
Just found the extras and some errors too.

export MANPAGER='sh -c "col -bx | '"$(printf "%q" "$EXECUTABLE_BAT")"' --language=man --style=grid '$(printf "%q " "${BAT_ARGS[@]}")'"'

-bx: 1: Syntax error: Unterminated quoted string

I found in bat's main repo README under integrations there is a simpler version too:

export MANPAGER="sh -c 'col -bx | bat -l man -p'"

-bx: 1: Syntax error: Unterminated quoted string

Both produce the same error though.
Thank you once again for your time and effort! it really is appreciated!

batwatch: $command does not exist

I'm using the bat-extras-git AUR package on Manjaro GNOME.

$ batwatch sensors
[batwatch error]: 'sensors' does not exist

Running watch sensors works as expected.

[bat error]: Unknown style 'GitHub'

The --help text told me to set the environment variable:

FORMATTER >>> none
bat 0.13.0
A cat(1) clone with syntax highlighting and Git integration.

USAGE:
    bat [OPTIONS] [FILE]...
    bat <SUBCOMMAND>

OPTIONS:
⋮
        --theme <theme>                  
            Set the theme for syntax highlighting. Use '--list-themes' to see all available themes.
            To set a default theme, add the '--theme="..."' option to the configuration file or
            export the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
        --list-themes                    
            Display a list of supported themes for syntax highlighting.

        --style <components>
            Configure which elements (line numbers, file headers, grid borders, Git modifications,
            ..) to display in addition to the file contents. The argument is a comma-separated list
            of components to display (e.g. 'numbers,changes,grid') or a pre-defined style ('full').
            To set a default style, add the '--style=".."' option to the configuration file or
            export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
            values: *auto*, full, plain, changes, header, grid, numbers, snip.
⋮
    -h, --help                           
            Print this help message.

    -V, --version                        
            Show version information.


ARGS:
    <FILE>...    
            File(s) to print / concatenate. Use a dash ('-') or no argument at all to read from
            standard input.

SUBCOMMANDS:
    cache    Modify the syntax-definition and theme cache

So then I tried --list-themes:

FORMATTER >>> none
1337
DarkNeon
Dracula
GitHub
Monokai Extended
Monokai Extended Bright
Monokai Extended Light
Monokai Extended Origin
Nord
OneHalfDark
OneHalfLight
Solarized (dark)
Solarized (light)
Sublime Snazzy
TwoDark
ansi-dark
ansi-light
base16
zenburn

Set the environment variable:

export BAT_STYLE='GitHub'

…and ran:

$ echo foo | prettybat
FORMATTER >>> none
[bat error]: Unknown style 'GitHub'

Line separators needed between matched lines.

When you have multiple matches for the same file, it's hard to tell where one match ends and another one begins. I can't do much to fix this without invoking bat for each line found, which will be extremely slow compared to the current method.

Waiting on sharkdp/bat#570 and a new release of bat to fix this properly.

batgrep: cannot overwrite BAT_STYLE

I prefer using bat as a cat with fancy colors so I disabled the numbers and headers. It would be great if batgrep would respect that setting.

batwatch: Pager blocks refreshing of data.

When bat has a pager enabled, batwatch can't refresh the screen. The pager should be disabled, and we should either clear the screen after every draw, or try to implement our own paging.

batman: support mouse wheel scrolling

Hey, I'm back with hopefully a quick one.

When using my default configured man, I can scroll with the keyboard or the mouse wheel. Is it possible or easy to have the mouse wheel work for batman as well?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.