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

3739 Commits

Author SHA1 Message Date
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 1424f9d6bf Merge pull request #3609 from Nicolas0315/fix/builtin-pager-drop-panic
Fix panic in BuiltinPager Drop when pager thread fails (#3449)
2026-03-02 04:57:37 +02:00
Nicolas fd67095cff Fix panic in BuiltinPager drop when pager thread panics
The Drop impl for OutputType::BuiltinPager calls
handle.take().unwrap().join().unwrap() which panics if the
pager thread itself panicked. In Drop, this causes a double
panic (abort).

Replace with if-let and discard the join result, matching the
pattern used for OutputType::Pager which also uses let _ =.

Reported in #3449 where BAT_PAGER=builtin with --help
causes the pager thread to fail.

Fixes #3449
2026-03-02 04:12:50 +09:00
auto-merge-dependabot-prs[bot] 908b1f22d1 Merge pull request #3608 from sharkdp/dependabot/cargo/bytesize-2.3.1
build(deps): bump bytesize from 1.3.0 to 2.3.1
2026-03-01 04:47:12 +00:00
dependabot[bot] 17a70d9b8c build(deps): bump bytesize from 1.3.0 to 2.3.1
Bumps [bytesize](https://github.com/bytesize-rs/bytesize) from 1.3.0 to 2.3.1.
- [Release notes](https://github.com/bytesize-rs/bytesize/releases)
- [Changelog](https://github.com/bytesize-rs/bytesize/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bytesize-rs/bytesize/compare/v1.3.0...bytesize-v2.3.1)

---
updated-dependencies:
- dependency-name: bytesize
  dependency-version: 2.3.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 04:36:13 +00:00
auto-merge-dependabot-prs[bot] 49d77a469a Merge pull request #3607 from sharkdp/dependabot/cargo/clap-4.5.60
build(deps): bump clap from 4.5.56 to 4.5.60
2026-03-01 04:33:43 +00:00
dependabot[bot] fa35495888 build(deps): bump clap from 4.5.56 to 4.5.60
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.56 to 4.5.60.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.56...clap_complete-v4.5.60)

---
updated-dependencies:
- dependency-name: clap
  dependency-version: 4.5.60
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 04:18:28 +00:00
auto-merge-dependabot-prs[bot] 8a858b19dc Merge pull request #3606 from sharkdp/dependabot/cargo/git2-0.20.4
build(deps): bump git2 from 0.20.3 to 0.20.4
2026-03-01 04:16:23 +00:00
dependabot[bot] 397252d2cc build(deps): bump git2 from 0.20.3 to 0.20.4
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.20.3 to 0.20.4.
- [Changelog](https://github.com/rust-lang/git2-rs/blob/git2-0.20.4/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-0.20.3...git2-0.20.4)

---
updated-dependencies:
- dependency-name: git2
  dependency-version: 0.20.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 04:00:55 +00:00
auto-merge-dependabot-prs[bot] 5e59957349 Merge pull request #3603 from sharkdp/dependabot/cargo/nix-0.31.2
build(deps): bump nix from 0.30.1 to 0.31.2
2026-03-01 03:58:09 +00:00
dependabot[bot] 90f8e00e0c build(deps): bump nix from 0.30.1 to 0.31.2
Bumps [nix](https://github.com/nix-rust/nix) from 0.30.1 to 0.31.2.
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.30.1...v0.31.2)

---
updated-dependencies:
- dependency-name: nix
  dependency-version: 0.31.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 03:35:51 +00:00
auto-merge-dependabot-prs[bot] 673929c189 Merge pull request #3604 from sharkdp/dependabot/cargo/serde_with-3.17.0
build(deps): bump serde_with from 3.16.1 to 3.17.0
2026-03-01 03:32:28 +00:00
dependabot[bot] e36bb8cc66 build(deps): bump serde_with from 3.16.1 to 3.17.0
Bumps [serde_with](https://github.com/jonasbb/serde_with) from 3.16.1 to 3.17.0.
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.16.1...v3.17.0)

---
updated-dependencies:
- dependency-name: serde_with
  dependency-version: 3.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 03:04:00 +00:00
Keith Hall 7d7e202bd5 Merge pull request #3588 from IMaloney/fix/warn-missing-pager
warn when pager is missing instead of silently falling back
2026-02-20 20:46:38 +02:00
Keith Hall 74de075748 Merge branch 'master' into fix/warn-missing-pager 2026-02-20 20:37:07 +02:00
Keith Hall 594069581d Merge pull request #3592 from IMaloney/fix/wrap-never-clean
respect --wrap=never flag when piping to pager
2026-02-20 20:26:23 +02:00
Ian Maloney 62b0388236 remove code comments 2026-02-20 06:12:14 +00:00
Ian Maloney 16d041492c fix pr number in changelog 2026-02-20 06:07:23 +00:00
Ian Maloney 22ee03ff00 add changelog entry for wrap-never bug fix 2026-02-20 06:04:29 +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 2c1a8caadd simplify: just never warn for less (universal default) 2026-02-19 22:49:02 +00:00
Ian Maloney a240aa4afd never warn for missing 'less' pager (common default) 2026-02-19 22:21:17 +00:00
Ian Maloney 00e38cd056 only warn for explicitly configured pagers, not defaults 2026-02-19 22:01:58 +00:00
Ian Maloney 335eff51f3 fix type error, pager.bin is already a string 2026-02-19 21:44:47 +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
Keith Hall fbc05da785 Merge pull request #3586 from BlueElectivire/master
Fixed manpage syntax to remove ANSI artifacts
2026-02-19 18:56:14 +02: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
Guy Barzilai 3ebfbb7ac5 Fixed manpage syntax to remove ANSI artifacts 2026-02-17 21:54:58 +02:00
Keith Hall 990b2fc06f Merge pull request #3583 from mainnebula/steward/sharkdp-bat-3555-2de8ac3c
feat: implement --unbuffered mode for streaming input
2026-02-12 08:40:44 +02:00
mainnebula 0c883d6f28 docs: add changelog entry for --unbuffered mode (#3583) 2026-02-11 23:45:20 -05: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
Keith Hall 391e7ff072 Merge pull request #3581 from NORMAL-EX/chore/update-time-crate
chore(deps): update time crate to 0.3.47 (RUSTSEC-2026-0009)
2026-02-07 13:37:17 +02:00
dddffgg 2b517199a2 docs: add changelog entry for MSRV bump and time crate update 2026-02-07 19:23:57 +08:00
dddffgg a0f326aa22 chore: bump MSRV to 1.88 2026-02-07 19:23:47 +08:00
dddffgg a4a7692134 chore(deps): update time crate to 0.3.47 (RUSTSEC-2026-0009) 2026-02-06 21:32:02 +08:00
Keith Hall 3df9d581b7 Merge pull request #3527 from Anchal-T/master
Fix bat crash with BusyBox less on Windows
2026-02-03 22:40:04 +02:00
Keith Hall eb724f2dc4 Merge branch 'master' into master 2026-02-03 22:27:30 +02:00
Keith Hall c491488140 Merge pull request #3578 from vorburger/nix
Add initial flake.nix; just for develop, for now (fixes#3577)
2026-02-03 22:25:49 +02:00
Michael Vorburger 3f12b1c1ab docs: Use PR not Issue ID in CHANGELOG.md 2026-02-01 14:20:40 +01:00
Michael Vorburger 2c682ff6a6 docs: Document flake.nix in CHANGELOG.md (see #3577) 2026-02-01 14:13:03 +01:00
Michael Vorburger 36b37e1aa5 Add x86_64-darwin (Intel macOS) to flake.nix 2026-02-01 14:11:05 +01:00
Michael Vorburger d19c80a7c1 Remove allowUnfree = true from flake.nix
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-01 14:09:18 +01:00
Michael Vorburger eff57943c9 Add initial flake.nix; just for develop, for now (fixes#3577) 2026-02-01 14:06:05 +01:00
Keith Hall 8664cc9df9 Merge pull request #3563 from NORMAL-EX/feat/quiet-empty
feat: add --quiet-empty flag to suppress output on empty input
2026-02-01 11:15:45 +02:00
dddffgg 3b34b47d55 docs: add --quiet-empty to PowerShell completion 2026-02-01 16:21:38 +08:00
dddffgg 9a5519057c docs: add --quiet-empty to fish completion 2026-02-01 16:21:22 +08:00