1
0
mirror of https://github.com/sharkdp/bat synced 2026-06-09 10:03:18 +00:00

31 Commits

Author SHA1 Message Date
Asish Kumar a9137fab05 Support BAT_WIDTH as an alias for --terminal-width
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
2026-04-12 01:12:55 +05:30
Rizky Mirzaviandy Priambodo 844bfded50 Add --fallback-syntax for undetected files (#3617)
* feat(cli): add fallback syntax option

Expose a new fallback syntax CLI option so users can opt into syntax highlighting only when auto-detection fails.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* feat(syntax): apply fallback only after detection fails

Use the fallback syntax only when path and first-line detection fail, preserving existing behavior for detected files and explicit language selection.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* test(cli): cover fallback syntax behavior

Add integration coverage for fallback syntax usage, precedence with --language, and no-op behavior when syntax is already detected; update help snapshots for the new option.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* docs(changelog): document fallback syntax option

Record the new fallback syntax feature in the unreleased changelog section.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-08 05:18:29 +02:00
Varun Chawla cc5f782d28 Add word wrapping mode (#3597)
* feat: add word wrapping mode for --wrap flag

* Run `cargo fmt` and add CHANGELOG entry

* Add word wrap tests, update manpage and shell completions

- Add integration tests for word wrapping: basic word boundary breaking,
  fallback to character wrapping for long words, line numbers, and
  short lines that fit without wrapping
- Update manpage to document the new 'word' wrapping mode
- Update bash, fish, zsh, and PowerShell completions with 'word' option
- Avoid unnecessary clone of `line_buf` when word wrap is disabled

* make clippy and cargo fmt happy

---------

Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com>
2026-03-03 05:18:49 +02:00
mainnebula 167dda63a8 feat: implement --unbuffered mode for streaming input (#3555)
Repurpose the existing --unbuffered/-u flag (previously a POSIX no-op)
to enable unbuffered input reading using fill_buf()/consume() instead
of read_until(b'\n'). This allows partial lines to display immediately
when piping streaming input like `tail -f` into bat.

- Add unbuffered field to Config and InputReader
- Add read_line_unbuffered() using BufRead::fill_buf()/consume()
- Add flush() to OutputHandle, called after each line in unbuffered mode
- Auto-disable line numbers in unbuffered mode to avoid partial line confusion
- Update help text, man page, and shell completions
- Add unit tests and integration tests
2026-02-11 23:27:08 -05:00
dddffgg fa66d8e3ef fix: correct position of --quiet-empty in long-help.txt 2026-02-01 11:48:10 +08:00
dddffgg 3aaec8cb3b docs: update long-help.txt with --quiet-empty flag 2026-01-31 17:02:24 +08:00
Louis Maddox 52a792d46f fix: allow hyphen values to -r/--line-range
via #2944
2025-10-19 21:24:59 +01:00
Louis Maddox 200924772f docs: amend man page (style modifies cat-like piping) 2025-10-18 10:29:39 +01:00
Academician c29f1875d3 Add --builtin=pager to readme, completions, and man pages 2025-09-09 16:26:49 -04:00
John Cavanaugh 6c13a98f01 feat: add context support to line-range syntax
docs(long-help.txt): 📚 add examples for N::C and N:M:C context syntax
docs(clap_app.rs): 📚 update CLI help text with context syntax examples
feat(line_range.rs):  implement N::C and N:M:C parsing and add tests
2025-07-15 16:17:09 -07:00
einfachIrgendwer0815 dbe25ba5e6 Include shell completions in the executable 2024-12-01 09:39:17 +01:00
Keith Hall 60693db73f Merge branch 'master' into dark-light 2024-11-13 20:33:37 +02:00
Tau Gärtli 89ce060183 Update help, man page and completions 2024-08-18 20:32:59 +02:00
Tau Gärtli bc42149a72 Merge color scheme options into theme / BAT_THEME 2024-08-18 14:59:14 +02:00
einfachIrgendwer0815 7f089ead62 Add option --binary
`--binary` allows to specify how to deal with binary content. Current
options are not printing anything or treating the binary data as text.
2024-08-18 10:05:37 +02:00
Tau Gärtli b9b981f657 Generalize --detect-color-scheme to --color-scheme 2024-08-16 14:14:30 +02:00
Tau Gärtli cea45e05f3 Expose new theme selection in CLI 2024-08-16 14:12:22 +02:00
Ethan P. 6e91ba83b7 Update clap/docs for merging --style arguments 2024-07-30 21:21:55 -07:00
Ethan P. 9e8176b1c6 Add --strip-ansi=auto option
When using `auto`, escape sequences will be stripped unless printing
plain text.
2024-06-17 18:27:33 -07:00
Ethan P. 70ff93d238 Add --strip-ansi option 2024-06-16 16:49:07 -07:00
einfachIrgendwer0815 83b00bc653 Rename --squeeze to --squeeze-blank 2024-02-24 14:02:27 +01:00
einfachIrgendwer0815 13204c46e2 Update short-help/long-help 2024-02-24 13:51:43 +01:00
David Peter 3ffa3648cf Merge pull request #2853 from einfachIrgendwer0815/document_default_style_components
Document default style components
2024-02-23 21:51:55 +01:00
einfachIrgendwer0815 875046e4cd Mention which style components are the default 2024-02-11 10:06:01 +01:00
Oliver looney 7ce010d9ed Using hypens instead of underscores for set-terminal-title command 2024-02-08 21:33:03 +00:00
Oliver looney 7f12989127 added set_terminal_title arg to clap_app.rs to fix ci errors 2024-01-29 09:47:41 +00:00
Oliver looney c911829771 fixed failing tests 2024-01-27 14:23:24 +00:00
einfachIrgendwer0815 26111950b3 Add environment variable BAT_PAGING 2023-09-01 17:59:41 +02:00
Constantin Nickel c094cd3ee5 Update clap to 4.1.8
This requires bumping the MSRV to 1.64.

It also updates the `terminal_size` crate that is pulled in by `clap` to
reduce duplicate dependencies.
2023-03-15 08:52:31 +01:00
einfachIrgendwer0815 8f99a78cf1 Print non-printable characters using caret notation (#2443)
When the new flag is set, non-printable characters are printed using caret notation.
2023-03-14 22:21:30 +01:00
Martin Nordholts 4e34b362f8 Require changes to -h and --help to be blessed
From now on, any changes to the help texts will be visible in PR diffs,
which will make it very easy to review, and very hard to accidentally
miss changes to help texts.

If a contributor makes a change to help texts, the `cargo test` failure
text they will see contains instructions on how to update the blessed
help texts:

    error: expect test failed
       --> ../doc/long-help.txt

    You can update all `expect!` tests by running:

        env UPDATE_EXPECT=1 cargo test

In short, to update blessed help texts, one simply does

    env UPDATE_EXPECT=1 cargo test

Do not run the tests if the `git` feature is missing, since then
`--diff` will be missing from `--help`. And do not run the tests on
Windows, because then the help text will contain the term `.exe`.

Move man page step to after cargo doc step so that the man page exists
when we look for it.
2022-12-30 09:59:52 +01:00