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

654 Commits

Author SHA1 Message Date
guille bceb260e91 Improve Kotlin syntax 2026-04-27 22:16:09 +03:00
Matt Van Horn 0ecdeb28d4 test(Tcl): regenerate shebang golden files to match patched syntax
The Tcl.sublime-syntax.patch adds first_line_match so bat recognizes
tclsh/wish/expect shebang files as Tcl. With the patch applied, the
leading '#!/...' and '# comment' lines get tokenized as Tcl comments
and rendered in Monokai-Extended's comment color instead of default
foreground.

The goldens were generated against unpatched bat in the original
commit, so CI's 'Run tests with updated syntaxes and themes' job (which
runs assets/create.sh before the regression test) disagreed. Regenerate
against the patched build so the regression test passes.
2026-04-18 09:42:26 -07:00
Matt Van Horn 77ea750e66 test(Tcl): add shebang source files for regression test
CI reported FileNotFoundError for Tcl/{tclsh,expect,wish}_shebang in
tests/syntax-tests/source/Tcl/. The highlighted files existed but the
source files had been omitted, so create_highlighted_versions.py had
nothing to read from.

Source files match the shebang regression test inputs at
tests/examples/regression_tests/issue_3647_*.
2026-04-18 06:58:45 -07:00
Matt Van Horn cafad6b036 test: add highlighted outputs for Tcl shebang regression tests
Generate highlighted test outputs for tclsh, wish, and expect
shebang detection files to prevent regressions.
2026-04-18 06:39:51 -07:00
Matt Van Horn e070d105b5 test: add shebang regression tests and move changelog to Syntaxes section
Add extensionless regression test files for tclsh, wish, and expect
shebangs so syntect bumps don't silently break first-line detection.
Move changelog entry from Features to Syntaxes per reviewer suggestion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 06:38:44 -07:00
Kira Security Bot 6876a782da Apply code changes: @orbisai0security can you address code review comm... 2026-04-12 12:37:43 +00:00
orbisai0security db647c9813 fix: V-001 security vulnerability
Automated security fix generated by Orbis Security AI
2026-04-12 11:43:12 +00:00
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
Asish Kumar 2459aa9404 Detect ZIP archives as binary content 2026-04-10 14:35:33 +00:00
Lucas Trzesniewski c64b6761fe Add .NET slnx extension
This is the new XML-based format for solution files.
2026-04-07 23:25:40 +02:00
Keith Hall 1e36873704 Merge branch 'master' into feat/diff-plain-compatibility 2026-03-21 16:21:56 +02:00
Matt Van Horn e86797fbf4 style: auto-format integration tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 15:46:54 -07:00
Eyüp Can Akman fc94a0ec49 fix: account for caret notation width in text wrapping
Control characters displayed in caret notation (e.g. ^@ for NUL)
occupy 2 terminal columns, but the width calculation treated them
as 0-width. Add a char_width() helper that returns 2 for control
characters, fixing incorrect line wrapping with --binary=as-text.

Fixes #3631
2026-03-20 22:28:39 +02:00
Matt Van Horn 169dc7c45b test: add integration tests for --diff combined with --plain 2026-03-20 10:33:33 -07:00
Alex Dukhan 91965d28a6 Add COBOL sans CPY ext 2026-03-11 14:36:20 +00:00
Alex Dukhan 88ff40f93e Merge branch 'master' into add-cobol-syntax 2026-03-11 11:26:01 +00:00
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
Keith Hall 74de075748 Merge branch 'master' into fix/warn-missing-pager 2026-02-20 20:37:07 +02:00
Ian Maloney 62b0388236 remove code comments 2026-02-20 06:12:14 +00:00
Ian Maloney 790bed3a2d fix: respect --wrap=never flag when paging is enabled
When output is piped to a pager, the wrapping_mode logic was not checking the explicit --wrap=never flag and would always default to NoWrapping(false). This meant the -S flag was not passed to less, causing lines to wrap despite the user's explicit request.

The fix prioritizes explicit CLI flags (--wrap=never, --chop-long-lines) over the interactive_output-based logic, ensuring they are always respected.

Fixes #3587
2026-02-20 06:04:14 +00:00
Ian Maloney bc84854d4b use cat as test pager instead of builtin (builtin is interactive, doesnt output to stdout) 2026-02-20 00:19:47 +00:00
Ian Maloney 319811df01 fix test: use builtin pager instead of less, revert to warn for all missing pagers 2026-02-20 00:09:02 +00:00
Ian Maloney d04b960c05 warn when pager is missing instead of silently falling back
when a configured pager (via BAT_PAGER, PAGER, or --pager) is not found,
bat now shows a warning message before falling back to stdout. this helps
users understand why their pager isn't running and makes it obvious when
there's a typo or PATH issue.

fixes issue #2904
2026-02-19 21:29:59 +00:00
Guy Barzilai a71d16fa1b Fixed manpage syntax-test format 2026-02-19 18:11:36 +02:00
Guy Barzilai 5bd08845a3 Fixed manpage regex regression and add syntax test 2026-02-18 23:59:38 +02:00
Alex Dukhan ab393a0281 Add COBOL syntax highlighting 2026-02-12 21:06:03 +00: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 cb8b637574 fix(cache): allow --help flag for cache subcommand (#3580)
* fix(cache): allow --help flag for cache subcommand

* docs: add changelog entry for cache --help fix
2026-02-09 05:06:40 +02:00
dddffgg 6a7936a26f test: add integration tests for --quiet-empty flag 2026-01-31 16:45:46 +08:00
Cosmic Horror 099d716455 Remove Visual Studio Dark+ theme 2026-01-14 21:13:44 -07:00
Your Name 31f982e736 Fixed formatting 2026-01-08 09:42:42 -05:00
Your Name 6c75acfffc Replace deprecated cargo_bin with cargo_bin! macro
The old Command::cargo_bin() is deprecated and will break when Cargo
changes build directory layout. Updated to use cargo_bin!() macro instead.

Bumped assert_cmd to 2.0.16 to get the new macro.

Fixes #3528
2026-01-08 09:28:11 -05:00
Lucas Trzesniewski c8514543af Fix integration tests on Windows 2025-12-27 21:17:40 +01:00
Hakil ad608014d9 fix issue #3526 (#3529) 2025-12-23 19:08:38 +02:00
Alex Kirk de414ed631 Limit overstrike stripping to man pages and help 2025-12-11 05:49:46 +01:00
Alex Kirk b22fc5db6b Add show-all integration test 2025-12-11 05:49:46 +01:00
Alex Kirk 64a4b204a2 Only strip overstrike when a syntax highlighting theme is used 2025-12-11 05:49:46 +01:00
Keith Hall d15e399fce [CSV] don't apply string highlighting by default 2025-12-07 21:55:05 +02:00
Keith Hall 1fb269a0fb Add syntax detection for files with ksh shebang lines 2025-12-02 22:06:21 +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 602df893de Add additional test cases for -n in loop through mode 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
Keith Hall efa9f0e63d add integration test to prove that building the cache finds all contexts 2025-11-24 22:20:44 +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
AldanTanneo 1abecd2c93 update Ada syntax gitmodule 2025-11-14 11:41:08 +01:00
Louis Maddox 52a792d46f fix: allow hyphen values to -r/--line-range
via #2944
2025-10-19 21:24:59 +01:00
Louis Maddox 7eedc0f854 feat(pipe-style): make output pipeable (any style) 2025-10-18 10:29:39 +01:00
Keith Hall 8920c738c5 chore: update highlighted test Markdown with embedded Typescript file 2025-10-14 22:02:16 +03:00