1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-13 15:23:18 +00:00
Commit Graph

1081 Commits

Author SHA1 Message Date
Alex Kirk 5fb8a25c30 Performance optimization 2025-12-11 05:49:46 +01:00
Alex Kirk 51bdaa5f88 Strip overstriking to better support man pages 2025-12-11 05:49:46 +01:00
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 0e469634a3 return None for get_pager_executable when builtin pager is used (#3498) 2025-12-01 20:02:55 +00: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
Cedric Staniewski a6e0057c12 Add syntax mapping for podman's artifact quadlet files 2025-11-30 14:18:12 +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
Keith Hall cfe49779fa Merge branch 'master' into fix/list-themes-pager-hang 2025-11-15 15:41:07 +02:00
cyqsimon f5a934c213 Update quadlet syntax mapping to include *.{build,pod} files 2025-11-13 13:44:24 +08:00
Abhinav Diwakar 24813db49f Merge branch 'master' into fix/list-themes-pager-hang 2025-11-06 23:26:06 +05:30
Benjamin A. Beasley ce856dbba7 Update etcetera to 0.11; no longer depend on home; MSRV 1.87
Release 0.11 of `etcetera` requires MSRV 1.87, in which
`std::env::home_dir` is no longer deprecated,
https://github.com/rust-lang/rust/pull/137327.

Update to that MSRV and to `etcetera`, and drop the dependency on the
`home` crate just as `etcetera` 0.11 did.
2025-11-03 19:06:33 +01: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
abhinavcool42 6a99915afe fix --list-themes hang 2025-10-28 16:10:32 +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
suranmiao f1a0d8b3f7 chore: fix some minor issues in the comments (#3439)
Signed-off-by: suranmiao <solsui@outlook.com>
2025-10-18 00:13:18 +03: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
Keith Hall 839bfded39 Map /var/log/dmesg to Syslog syntax 2025-09-27 22:48:13 +03:00
Ritoban Dutta e879f532a7 Mapping .kshrc to bash for syntax highlighting #3361 (#3364)
* Add syntax highlighting support for .kshrc files and update mapping in KornShell syntax #3361
2025-09-23 16:56:52 +00:00
jyn c8b8132228 Only leave space for git diff markers if any line is modified (#3406)
Previously, setting `--style=changes` would always print a 2-space
indent, even if the file was unmodified. This changes the style to only
print an indent if there is at least one +/- git marker in the sidebar.
2025-09-22 07:42:56 +02: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
Eric Menne d397bea6dc Fix typo and clarify description 2025-08-22 17:49:53 +03:00
Eric Menne d9dd9729b8 Add flag to less to enable quitting on Ctrl-C 2025-08-22 17:49:53 +03: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
Keith Hall bdaf25793d cargo fmt 2025-08-16 15:36:45 +03:00
Keith Hall 96ce80d0e2 Apply same fix and tests for UTF16BE 2025-08-16 15:36:45 +03:00
Keith Hall 40c4c8e542 More thorough tests for UTF16LE 2025-08-16 15:35:57 +03:00
Keith Hall 6675153460 Fix the read_line method for utf16le input
to determine the end of the line, instead of reading until \n (0x0A) and then reading until 0x00 and calling it done, read until we find 0x00 preceded by 0x0A.
2025-08-16 15:35:57 +03:00
John Cavanaugh 3fd3f1def8 Merge branch 'master' into master 2025-08-13 23:27:26 -07:00
Ferenc Géczi 20caaf26c8 Add syntax mapping for flatpakrepo
Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
2025-07-31 00:00:00 +00:00
Ferenc Géczi 3574118e17 Add syntax mapping for flatpakref
Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
2025-07-31 00:00:00 +00:00
Tau Gärtli feb0bc1ae6 Update terminal-colorsaurus to 1.0 2025-07-22 07:15:52 +02:00
Keith Hall 8b12191bda Make map-syntax target case insensitive 2025-07-17 22:19:54 +03:00
John Cavanaugh bb8c5657e1 fix: 🐛 allow three-part range parsing
fix(src/line_range.rs): 🐛 support three-part (start:end:context) syntax, clamp lower at zero and extend upper, and add tests for invalid formats
2025-07-15 16:36:58 -07:00
John Cavanaugh dc2eae08a6 docs: 📚 update changelog for range context support
docs(CHANGELOG.md): 📚 add entry for context in line ranges and normalize list formatting
style(src/line_range.rs): 🎨 trim trailing whitespace in context parsing code
2025-07-15 16:25:28 -07: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
Y.D.X. 4661f22e81 Merge remote-tracking branch 'upstream/master' into lean 2025-07-11 13:03:06 +08:00