1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-20 16:33:20 +00:00
Commit Graph

295 Commits

Author SHA1 Message Date
Keith Hall b7dd88eafd Support custom assets (themes) when displaying help output 2025-12-10 22:30:01 +02:00
Keith Hall 1796324531 Fix --help --pager=builtin
Previously it still used less
2025-12-04 21:53:45 +02:00
Keith Hall 579d371378 Ensure --help respects valid config file
While still ignoring ignoring invalid arguments in the config
2025-12-01 05:30:05 +02:00
Keith Hall 3755f788ca Improve -n detection to handle combined flags correctly
Updated the logic to correctly handle combined short flags like -pn and -np.
The -n flag is only honored when it's either:
1. A standalone flag (-n or --number)
2. The last flag in a combined form that includes -p (e.g., -pn), or
3. In a combined form without -p (e.g., -An)

This ensures that -np (where -p overrides -n) correctly produces plain output,
while -pn (where -n overrides -p) produces line numbers.
2025-11-30 05:02:13 +02:00
Keith Hall abc7261488 Fix -n flag to show line numbers in loop-through mode
When the -n/--number flag is passed on the command line, bat now shows
line numbers even when piping output to another process (loop-through
mode), similar to how `cat -n` behaves.

This change detects if -n or --number was passed on the CLI (before
merging with config file and environment variables) and disables
loop-through mode in that case, allowing the InteractivePrinter to
add line numbers.

The existing behavior is preserved:
- Styles from config/env are still ignored when piping (unless --decorations=always is set)
- Only the -n flag from CLI enables line numbers in piped mode
- -p and --style options from CLI do not disable loop-through mode
2025-11-30 05:02:13 +02:00
Keith Hall 7d37325c19 Fix to not show style decorations in auto mode when piping 2025-11-30 05:02:13 +02:00
Muntasir Mahmud 70ec3fc24e feat: add paging to '-h' and '--help' (#3478)
* feat: add paging to '-h' and '--help'

Fixes #1587
2025-11-23 20:10:56 +00:00
abhinavcool42 8b09724420 change imports 2025-11-02 11:55:30 +05:30
abhinavcool42 2af7be1b65 fix prefix 2025-11-02 11:51:00 +05:30
abhinavcool42 9456f7d8cd list-themes buffer added 2025-11-02 11:31:07 +05:30
abhinavcool42 1852dea96a Fix --list-themes pager init so less stays interactive 2025-10-30 18:42:35 +05:30
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
Louis Maddox 7eedc0f854 feat(pipe-style): make output pipeable (any style) 2025-10-18 10:29:39 +01:00
Keith Hall 2badaf5d99 cargo fmt 2025-10-08 22:45:50 +03:00
Keith Hall 588ff32d18 Fix help/version/diagnostic commands with invalid config 2025-10-08 22:45:50 +03:00
Academician c29f1875d3 Add --builtin=pager to readme, completions, and man pages 2025-09-09 16:26:49 -04:00
Daniel Waechter a470cebf32 Add a "builtin" pager using the Minus crate 2025-09-09 16:15:54 -04:00
John Cavanaugh 36d25c8642 Merge branch 'master' into master 2025-08-19 20:34:08 -07:00
Yuri Astrakhan 503c50b1ec chore: address all cargo clippy lints
* also do a bit of a doc cleanup for the `load_from_folder` fn
2025-08-19 05:22:47 +02:00
Yuri Astrakhan d9fbd18541 inline format arguments
In a few cases, removed the unneeded `&` - this causes a minor slowdown because compiler cannot eliminate those (yet).
2025-08-19 05:07:54 +02: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
cyqsimon 555933315d Only start offload worker thread when there's more than 1 core (#2956)
* Only start offload worker thread when there's more than 1 core

* Write changelog
2025-07-15 05:21:00 +02:00
einfachIrgendwer0815 12a2a451b4 Add paging to --list-themes 2025-04-02 11:27:37 +02:00
einfachIrgendwer0815 cc46282866 Fix clippy::into_iter_on_ref warnings 2025-02-02 15:08:13 +01:00
einfachIrgendwer0815 4f161705a3 Fix: Don't output default theme info to piped stdout 2025-01-27 17:11:26 +01: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
einfachIrgendwer0815 3b71837174 Merge branch 'master' into fix/2731_plain_override 2024-10-30 13:06:13 +01:00
einfachIrgendwer0815 8d82402d74 Merge branch 'master' into feature/binary_as_text 2024-10-30 12:46:11 +01:00
einfachIrgendwer0815 c9fd0f3cf0 Add partial override of -pp and --paging 2024-10-18 12:13:41 +02:00
einfachIrgendwer0815 fd6c7637e4 Partially revert "Make -pp override --paging and vice versa when passed as a later argument. (#2660)"
This partially reverts commit e2bf85e749.
2024-10-18 11:46:51 +02:00
Tau Gärtli 60e4027332 Expose theme env vars 2024-09-07 21:36:02 +02:00
Tau Gärtli 16d9b99f6c Flatten preference enum 2024-09-04 21:18:29 +02:00
einfachIrgendwer0815 0603f0b844 Don't output default theme info to piped stdout 2024-08-25 10:54:46 +02:00
Tau Gärtli 50958472e5 Return theme alongside detected color scheme 2024-08-23 18:03:07 +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 5c6974703e Respect --detect-color-scheme flag when listing themes 2024-08-16 14:13:58 +02:00
Tau Gärtli 1b0a6da4be Use new default_theme fn for --list-themes 2024-08-16 14:13:58 +02:00
Tau Gärtli ff81cfd584 Move actual detection into library 2024-08-16 14:13:16 +02:00
Tau Gärtli cea45e05f3 Expose new theme selection in CLI 2024-08-16 14:12:22 +02:00
Ethan P. aa3ec109b7 First StyleComponentList should remove from 'auto' style.
This happens when there are no `--style` arguments other than the one
passed in as a command line argument.

Prior to this change, removing a style component (e.g. `--style=-numbers`)
would remove the component from an empty style component set, resulting
in no styles at all. That behaviour was less intuitive than the new
behaviour, which starts out with the default components and
removes the line numbers.
2024-07-30 21:22:02 -07:00
Ethan P. 93b25d75a0 Join env var options with "=" instead of " "
Joining them with a space was causing certain styles (e.g. `-grid`) to
be misinterpreted as a separate option.
2024-07-30 21:21:58 -07:00
Ethan P. 6e91ba83b7 Update clap/docs for merging --style arguments 2024-07-30 21:21:55 -07:00
Ethan P. b74c125c43 Support merging --style arguments
The `overrides_with` clap builder option was removed
because it interfered with the matcher's ability to
retain all occurrences of `--style`.

The behavior it covered is expressed within the new
`forced_style_components` function.
2024-07-30 21:21:53 -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