From ad608014d95691abbad3904a7a9501ca66729ff1 Mon Sep 17 00:00:00 2001 From: Hakil Date: Tue, 23 Dec 2025 18:08:38 +0100 Subject: [PATCH 01/43] fix issue #3526 (#3529) --- CHANGELOG.md | 2 ++ src/bin/bat/app.rs | 2 +- tests/integration_tests.rs | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddefdcf5..96d9edbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # unreleased +- Fixed bug caused by using `--plain` and `--terminal-width=N` flags simultaneously, see #3529 (@H4k1l) + ## Features - Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk) diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 2df38f27..1ba3e73d 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -405,7 +405,7 @@ impl App { Some("character") => WrappingMode::Character, Some("never") => WrappingMode::NoWrapping(true), Some("auto") | None => { - if style_components.plain() { + if style_components.plain() && maybe_term_width.is_none() { WrappingMode::NoWrapping(false) } else { WrappingMode::Character diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 8896d9fa..bd887a2a 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -3631,3 +3631,17 @@ fn style_components_will_merge_with_env_var() { .stdout(" STDIN\n 1 test\n") .stderr(""); } + +// Test for https://github.com/sharkdp/bat/issues/3526 +#[test] +fn plain_with_sized_terminal_width() { + bat() + .arg("--plain") + .arg("--terminal-width=6") + .arg("--decorations=always") + .arg("test.txt") + .assert() + .success() + .stdout("hello \nworld\n") + .stderr(""); +} From c8514543af286d94ea5e1e9edf9d87a8a39a4541 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Sat, 27 Dec 2025 21:17:40 +0100 Subject: [PATCH 02/43] Fix integration tests on Windows --- .gitignore | 4 +++ tests/integration_tests.rs | 57 ++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index fbfe6ac6..fa381206 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ /target/ **/*.rs.bk +# Editors +.idea/ +.vscode/ + # Generated files /assets/completions/_bat.ps1 /assets/completions/bat.bash diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index bd887a2a..250b3d2e 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1357,27 +1357,33 @@ fn disable_pager_if_pp_flag_comes_after_paging() { } #[test] +#[serial] fn enable_pager_if_disable_paging_flag_comes_before_paging() { - bat() - .env("PAGER", "echo pager-output") - .arg("-P") - .arg("--paging=always") - .arg("test.txt") - .assert() - .success() - .stdout(predicate::eq("pager-output\n").normalize()); + mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| { + bat() + .env("PAGER", mocked_pagers::from("echo pager-output")) + .arg("-P") + .arg("--paging=always") + .arg("test.txt") + .assert() + .success() + .stdout(predicate::str::contains("pager-output\n").normalize()); + }); } #[test] +#[serial] fn enable_pager_if_pp_flag_comes_before_paging() { - bat() - .env("PAGER", "echo pager-output") - .arg("-pp") - .arg("--paging=always") - .arg("test.txt") - .assert() - .success() - .stdout(predicate::eq("pager-output\n").normalize()); + mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| { + bat() + .env("PAGER", mocked_pagers::from("echo pager-output")) + .arg("-pp") + .arg("--paging=always") + .arg("test.txt") + .assert() + .success() + .stdout(predicate::str::contains("pager-output\n").normalize()); + }); } #[test] @@ -1394,15 +1400,18 @@ fn paging_does_not_override_simple_plain() { } #[test] +#[serial] fn simple_plain_does_not_override_paging() { - bat() - .env("PAGER", "echo pager-output") - .arg("--paging=always") - .arg("--plain") - .arg("test.txt") - .assert() - .success() - .stdout(predicate::eq("pager-output\n")); + mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| { + bat() + .env("PAGER", mocked_pagers::from("echo pager-output")) + .arg("--paging=always") + .arg("--plain") + .arg("test.txt") + .assert() + .success() + .stdout(predicate::str::contains("pager-output\n").normalize()); + }); } #[test] From b34a1e0cc241d60ce941cf91e03f342e77a0157a Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Sat, 27 Dec 2025 19:13:56 +0100 Subject: [PATCH 03/43] Make the repository clone correctly under Windows --- .gitmodules | 2 +- assets/syntaxes/02_Extra/Jinja2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6c5ceb2d..dc20c09d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -130,7 +130,7 @@ url = https://github.com/djuretic/SublimeStrace [submodule "assets/syntaxes/Jinja2"] path = assets/syntaxes/02_Extra/Jinja2 - url = https://github.com/Martin819/sublime-jinja2 + url = https://github.com/senekor/sublime-jinja2 [submodule "assets/syntaxes/SLS"] path = assets/syntaxes/02_Extra/SLS url = https://github.com/saltstack/sublime-text diff --git a/assets/syntaxes/02_Extra/Jinja2 b/assets/syntaxes/02_Extra/Jinja2 index 45355633..e572427f 160000 --- a/assets/syntaxes/02_Extra/Jinja2 +++ b/assets/syntaxes/02_Extra/Jinja2 @@ -1 +1 @@ -Subproject commit 45355633d17ee562481ca1d2ad0e3502c238f58a +Subproject commit e572427f6ac5f71fa2b9cf93e976a99bff4a3e94 From 56678dc771691cc71ec36c9cf04bdd54785bbd0f Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Sat, 27 Dec 2025 20:39:02 +0100 Subject: [PATCH 04/43] Change the Jinja2 fork URL --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index dc20c09d..638b4d9b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -130,7 +130,7 @@ url = https://github.com/djuretic/SublimeStrace [submodule "assets/syntaxes/Jinja2"] path = assets/syntaxes/02_Extra/Jinja2 - url = https://github.com/senekor/sublime-jinja2 + url = https://github.com/ltrzesniewski/sublime-jinja2.git [submodule "assets/syntaxes/SLS"] path = assets/syntaxes/02_Extra/SLS url = https://github.com/saltstack/sublime-text From 88d6fd0248e8aa3f6ae5f906402fdcf56ba04a4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jan 2026 03:02:10 +0000 Subject: [PATCH 05/43] build(deps): bump tempfile from 3.16.0 to 3.23.0 Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.16.0 to 3.23.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.16.0...v3.23.0) --- updated-dependencies: - dependency-name: tempfile dependency-version: 3.23.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 32 +++++++++++++++++++++++++------- Cargo.toml | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3347f51..04afb122 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -956,6 +956,12 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + [[package]] name = "litemap" version = "0.7.4" @@ -1319,10 +1325,23 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", "windows-sys 0.59.0", ] +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + [[package]] name = "ryu" version = "1.0.18" @@ -1591,16 +1610,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.16.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ - "cfg-if", "fastrand", "getrandom", "once_cell", - "rustix", - "windows-sys 0.59.0", + "rustix 1.1.2", + "windows-sys 0.61.2", ] [[package]] @@ -1644,7 +1662,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5352447f921fda68cf61b4101566c0bdb5104eff6804d0678e5227580ab6a4e9" dependencies = [ - "rustix", + "rustix 0.38.43", "windows-sys 0.59.0", ] diff --git a/Cargo.toml b/Cargo.toml index e26e86b9..5cf4fec6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,7 @@ expect-test = "1.5.0" serial_test = { version = "2.0.0", default-features = false } predicates = "3.1.3" wait-timeout = "0.2.1" -tempfile = "3.16.0" +tempfile = "3.23.0" serde = { version = "1.0", features = ["derive"] } [target.'cfg(unix)'.dev-dependencies] From c12cdcace3166291b43e2873b10321c0096e6897 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jan 2026 03:19:08 +0000 Subject: [PATCH 06/43] build(deps): bump nu-ansi-term from 0.50.1 to 0.50.3 Bumps [nu-ansi-term](https://github.com/nushell/nu-ansi-term) from 0.50.1 to 0.50.3. - [Release notes](https://github.com/nushell/nu-ansi-term/releases) - [Changelog](https://github.com/nushell/nu-ansi-term/blob/main/CHANGELOG.md) - [Commits](https://github.com/nushell/nu-ansi-term/compare/v0.50.1...v0.50.3) --- updated-dependencies: - dependency-name: nu-ansi-term dependency-version: 0.50.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 15 +++------------ Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04afb122..64942319 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1066,11 +1066,11 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.50.1" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2052,15 +2052,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.59.0" diff --git a/Cargo.toml b/Cargo.toml index 5cf4fec6..787bb9cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine [dependencies] -nu-ansi-term = "0.50.0" +nu-ansi-term = "0.50.3" ansi_colours = "^1.2" bincode = "1.0" console = "0.16.1" From 3276e9469ac37711aeebacc007371a842efebada Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jan 2026 04:03:19 +0000 Subject: [PATCH 07/43] build(deps): bump console from 0.16.1 to 0.16.2 Bumps [console](https://github.com/console-rs/console) from 0.16.1 to 0.16.2. - [Release notes](https://github.com/console-rs/console/releases) - [Changelog](https://github.com/console-rs/console/blob/main/CHANGELOG.md) - [Commits](https://github.com/console-rs/console/compare/0.16.1...0.16.2) --- updated-dependencies: - dependency-name: console dependency-version: 0.16.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 64942319..3c019b40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,9 +297,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "console" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b430743a6eb14e9764d4260d4c0d8123087d504eeb9c48f2b2a5e810dd369df4" +checksum = "03e45a4a8926227e4197636ba97a9fc9b00477e9f4bd711395687c5f0734bec4" dependencies = [ "encode_unicode", "libc", diff --git a/Cargo.toml b/Cargo.toml index 787bb9cc..c0915cdb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine nu-ansi-term = "0.50.3" ansi_colours = "^1.2" bincode = "1.0" -console = "0.16.1" +console = "0.16.2" flate2 = "1.1" once_cell = "1.20" thiserror = "2.0" From d48bf240a79036f8307e94382c2770350b889a88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jan 2026 04:20:47 +0000 Subject: [PATCH 08/43] build(deps): bump shell-words from 1.1.0 to 1.1.1 Bumps [shell-words](https://github.com/tmiasko/shell-words) from 1.1.0 to 1.1.1. - [Commits](https://github.com/tmiasko/shell-words/compare/v1.1.0...v1.1.1) --- updated-dependencies: - dependency-name: shell-words dependency-version: 1.1.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c019b40..43f40e56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1486,9 +1486,9 @@ checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" [[package]] name = "shell-words" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" [[package]] name = "shlex" diff --git a/Cargo.toml b/Cargo.toml index c0915cdb..757011d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ once_cell = "1.20" thiserror = "2.0" wild = { version = "2.2", optional = true } content_inspector = "0.2.4" -shell-words = { version = "1.1.0", optional = true } +shell-words = { version = "1.1.1", optional = true } minus = { version = "5.6", optional = true, features = [ "dynamic_output", "search", From 6c75acfffcf63ca8df7a3e4b2808f64ceb13cdf2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 09:28:11 -0500 Subject: [PATCH 09/43] 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 --- Cargo.lock | 11 ++--------- Cargo.toml | 2 +- tests/tester/mod.rs | 13 ++----------- tests/utils/command.rs | 2 +- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43f40e56..10607f7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,13 +83,12 @@ checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "assert_cmd" -version = "2.0.16" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" +checksum = "bcbb6924530aa9e0432442af08bbcafdad182db80d2e560da42a6d442535bf85" dependencies = [ "anstyle", "bstr", - "doc-comment", "libc", "predicates", "predicates-core", @@ -471,12 +470,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d" -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "either" version = "1.13.0" diff --git a/Cargo.toml b/Cargo.toml index 757011d4..828520b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ features = ["wrap_help", "cargo"] plist = "1.7.0" [dev-dependencies] -assert_cmd = "2.0.12" +assert_cmd = "2.0.16" expect-test = "1.5.0" serial_test = { version = "2.0.0", default-features = false } predicates = "3.1.3" diff --git a/tests/tester/mod.rs b/tests/tester/mod.rs index 6c7e4226..42d88afd 100644 --- a/tests/tester/mod.rs +++ b/tests/tester/mod.rs @@ -52,17 +52,8 @@ impl BatTester { impl Default for BatTester { fn default() -> Self { let temp_dir = create_sample_directory().expect("sample directory"); - - let root = env::current_exe() - .expect("tests executable") - .parent() - .expect("tests executable directory") - .parent() - .expect("bat executable directory") - .to_path_buf(); - - let exe_name = if cfg!(windows) { "bat.exe" } else { "bat" }; - let exe = root.join(exe_name); + + let exe = assert_cmd::cargo::cargo_bin!("bat").to_path_buf(); BatTester { temp_dir, exe } } diff --git a/tests/utils/command.rs b/tests/utils/command.rs index 40b01960..3a077d66 100644 --- a/tests/utils/command.rs +++ b/tests/utils/command.rs @@ -4,7 +4,7 @@ use assert_cmd::cargo::CommandCargoExt; use std::process::Command; pub fn bat_raw_command_with_config() -> Command { - let mut cmd = Command::cargo_bin("bat").unwrap(); + let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("bat")); cmd.current_dir("tests/examples"); cmd.env_remove("BAT_CACHE_PATH"); cmd.env_remove("BAT_CONFIG_DIR"); From 0a97a1edd7d5d2262aa5a3646dda63fe0ce0a816 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 09:35:01 -0500 Subject: [PATCH 10/43] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d9edbc..b8c6493b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ## Bugfixes - `--help` now correctly honors `--pager=builtin`. See #3516 (@keith-hall) - `--help` now correctly honors custom themes. See #3524 (@keith-hall) +- Fixed test compatibility with future Cargo build directory changes, see #3528 (@nmacl) ## Other From 31f982e736cc8d1b39164c29126fbfcf545abf8d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 09:42:42 -0500 Subject: [PATCH 11/43] Fixed formatting --- tests/tester/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tester/mod.rs b/tests/tester/mod.rs index 42d88afd..b25a634c 100644 --- a/tests/tester/mod.rs +++ b/tests/tester/mod.rs @@ -52,7 +52,7 @@ impl BatTester { impl Default for BatTester { fn default() -> Self { let temp_dir = create_sample_directory().expect("sample directory"); - + let exe = assert_cmd::cargo::cargo_bin!("bat").to_path_buf(); BatTester { temp_dir, exe } From 57bf8ff7dac2f2830dda9bbe4d1225bc60e01509 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 09:45:41 -0500 Subject: [PATCH 12/43] Update changelog with PR number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8c6493b..02340944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ ## Bugfixes - `--help` now correctly honors `--pager=builtin`. See #3516 (@keith-hall) - `--help` now correctly honors custom themes. See #3524 (@keith-hall) -- Fixed test compatibility with future Cargo build directory changes, see #3528 (@nmacl) +- Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl) ## Other From 3cb55e85d028c01c75797e2f18cbd5329ca17df9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 03:20:00 +0000 Subject: [PATCH 13/43] build(deps): bump actions/checkout from 5 to 6 Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CICD.yml | 18 +++++++++--------- .../workflows/require-changelog-for-PRs.yml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 6274941a..f1bc3887 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -35,7 +35,7 @@ jobs: name: Extract crate metadata runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Extract crate information id: crate_metadata run: | @@ -58,7 +58,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt,clippy - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - run: cargo fmt -- --check - run: cargo clippy --locked --all-targets --all-features -- -D warnings @@ -68,7 +68,7 @@ jobs: needs: crate_metadata steps: - name: Checkout source code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }}) uses: dtolnay/rust-toolchain@master with: @@ -80,7 +80,7 @@ jobs: name: License checks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: true # we especially want to perform license checks on submodules - run: tests/scripts/license-checks.sh @@ -90,7 +90,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: true # we need all syntax and theme submodules - name: Install Rust toolchain @@ -119,7 +119,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Prepare environment variables run: | echo "BAT_SYSTEM_CONFIG_PREFIX=$GITHUB_WORKSPACE/tests/examples/system_config" >> $GITHUB_ENV @@ -135,7 +135,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - name: Check documentation @@ -150,7 +150,7 @@ jobs: runs-on: ubuntu-latest steps: - run: cargo install cargo-audit --locked - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - run: cargo audit build: @@ -178,7 +178,7 @@ jobs: BUILD_CMD: cargo steps: - name: Checkout source code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Install prerequisites shell: bash diff --git a/.github/workflows/require-changelog-for-PRs.yml b/.github/workflows/require-changelog-for-PRs.yml index a3905df6..3c8cca37 100644 --- a/.github/workflows/require-changelog-for-PRs.yml +++ b/.github/workflows/require-changelog-for-PRs.yml @@ -13,7 +13,7 @@ jobs: PR_NUMBER: ${{ github.event.number }} PR_BASE: ${{ github.base_ref }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Fetch PR base run: git fetch --no-tags --prune --depth=1 origin From 099d71645592433958a702e3fd0f31a42cbf1bf2 Mon Sep 17 00:00:00 2001 From: Cosmic Horror Date: Wed, 14 Jan 2026 21:03:32 -0700 Subject: [PATCH 14/43] Remove Visual Studio Dark+ theme --- .gitmodules | 3 --- CHANGELOG.md | 2 ++ assets/themes/visual-studio-dark-plus | 1 - tests/assets.rs | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) delete mode 160000 assets/themes/visual-studio-dark-plus diff --git a/.gitmodules b/.gitmodules index 638b4d9b..ee84fe05 100644 --- a/.gitmodules +++ b/.gitmodules @@ -203,9 +203,6 @@ [submodule "assets/syntaxes/02_Extra/SystemVerilog"] path = assets/syntaxes/02_Extra/SystemVerilog url = https://github.com/TheClams/SystemVerilog.git -[submodule "assets/themes/visual-studio-dark-plus"] - path = assets/themes/visual-studio-dark-plus - url = https://github.com/vidann1/visual-studio-dark-plus.git [submodule "assets/syntaxes/02_Extra/SublimeEthereum"] path = assets/syntaxes/02_Extra/SublimeEthereum url = https://github.com/davidhq/SublimeEthereum.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 02340944..c6e1ae81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ ## Themes +- Remove the Visual Studio Dark+ theme, see #3552 (@CosmicHorrorDev) + ## `bat` as a library # v0.26.1 diff --git a/assets/themes/visual-studio-dark-plus b/assets/themes/visual-studio-dark-plus deleted file mode 160000 index 01ee1e8e..00000000 --- a/assets/themes/visual-studio-dark-plus +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 01ee1e8e0dc578f3b4e8c0dbb6aa0279b4a26a40 diff --git a/tests/assets.rs b/tests/assets.rs index 358e07ea..99ccb599 100644 --- a/tests/assets.rs +++ b/tests/assets.rs @@ -34,7 +34,6 @@ fn all_themes_are_present() { "Solarized (light)", "Sublime Snazzy", "TwoDark", - "Visual Studio Dark+", "ansi", "base16", "base16-256", From 6b8decf2a474545c02a961fe84771626dc325651 Mon Sep 17 00:00:00 2001 From: Cedric Erdelen Date: Wed, 28 Jan 2026 14:12:32 +0100 Subject: [PATCH 15/43] Small typo fixes --- src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index a4dd626f..2596d9e5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -99,13 +99,13 @@ pub struct Config<'a> { #[cfg(feature = "lessopen")] pub use_lessopen: bool, - // Weather or not to set terminal title when using a pager + // Whether or not to set terminal title when using a pager pub set_terminal_title: bool, /// The maximum number of consecutive empty lines to display pub squeeze_lines: Option, - // Weather or not to set terminal title when using a pager + // Whether or not to set terminal title when using a pager pub strip_ansi: StripAnsiMode, } From 69a2ffbdac45160dcdd816f6a326ffa66a89a7ba Mon Sep 17 00:00:00 2001 From: cerdelen <95369756+cerdelen@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:48:02 +0100 Subject: [PATCH 16/43] Update src/config.rs Co-authored-by: Keith Hall --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 2596d9e5..74fb4dac 100644 --- a/src/config.rs +++ b/src/config.rs @@ -105,7 +105,7 @@ pub struct Config<'a> { /// The maximum number of consecutive empty lines to display pub squeeze_lines: Option, - // Whether or not to set terminal title when using a pager + // Whether or not to strip ANSI escape codes from the input pub strip_ansi: StripAnsiMode, } From f6f1f18e9cb0d6aaaf51d9fd96911a07d211bfe2 Mon Sep 17 00:00:00 2001 From: Cedric Erdelen Date: Wed, 28 Jan 2026 19:59:10 +0100 Subject: [PATCH 17/43] remove trailing whitespace --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 74fb4dac..aa223186 100644 --- a/src/config.rs +++ b/src/config.rs @@ -105,7 +105,7 @@ pub struct Config<'a> { /// The maximum number of consecutive empty lines to display pub squeeze_lines: Option, - // Whether or not to strip ANSI escape codes from the input + // Whether or not to strip ANSI escape codes from the input pub strip_ansi: StripAnsiMode, } From 626154317fd888230cf1218cb2ba2565c1b3174e Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:40:59 +0800 Subject: [PATCH 18/43] feat: add quiet_empty config option --- src/config.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config.rs b/src/config.rs index aa223186..7209c2fd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -107,6 +107,9 @@ pub struct Config<'a> { // Whether or not to strip ANSI escape codes from the input pub strip_ansi: StripAnsiMode, + + /// Whether or not to produce no output when input is empty + pub quiet_empty: bool, } #[cfg(all(feature = "minimal-application", feature = "paging"))] From 53a10e0b0a93d3979bf3c6a641f353b5156914a6 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:41:13 +0800 Subject: [PATCH 19/43] feat: add --quiet-empty CLI flag --- src/bin/bat/clap_app.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index acb505ee..10bf7a8b 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -643,6 +643,18 @@ pub fn build_app(interactive_output: bool) -> Command { .hide_short_help(true) .help("Show diagnostic information for bug reports."), ) + .arg( + Arg::new("quiet-empty") + .long("quiet-empty") + .short('E') + .action(ArgAction::SetTrue) + .help("Produce no output when the input is empty.") + .long_help( + "When this flag is set, bat will produce no output at all when \ + the input is empty. This is useful when piping commands that may \ + produce empty output, like 'git diff'.", + ), + ) .arg( Arg::new("acknowledgements") .long("acknowledgements") From 6f0a61cef962c203031f83f0a3e1275598d5a7f6 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:41:46 +0800 Subject: [PATCH 20/43] feat: wire up quiet_empty config in app --- src/bin/bat/app.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 1ba3e73d..f5f59ec7 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -461,6 +461,7 @@ impl App { Some("auto") => StripAnsiMode::Auto, _ => unreachable!("other values for --strip-ansi are not allowed"), }, + quiet_empty: self.matches.get_flag("quiet-empty"), theme: theme(self.theme_options()).to_string(), visible_lines: match self.matches.try_contains_id("diff").unwrap_or_default() && self.matches.get_flag("diff") From 783acbc83dda26c14b99aa0d2fa3eb0d08305825 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:42:28 +0800 Subject: [PATCH 21/43] feat: implement quiet_empty behavior in printer --- src/printer.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/printer.rs b/src/printer.rs index 1ddd5e66..3c3facf5 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -454,6 +454,11 @@ impl Printer for InteractivePrinter<'_> { input: &OpenedInput, add_header_padding: bool, ) -> Result<()> { + // If input is empty and quiet_empty is enabled, skip all output + if self.content_type.is_none() && self.config.quiet_empty { + return Ok(()); + } + if add_header_padding && self.config.style_components.rule() { self.print_horizontal_line_term(handle, self.colors.rule)?; } @@ -556,6 +561,11 @@ impl Printer for InteractivePrinter<'_> { } fn print_footer(&mut self, handle: &mut OutputHandle, _input: &OpenedInput) -> Result<()> { + // If input is empty and quiet_empty is enabled, skip footer + if self.content_type.is_none() && self.config.quiet_empty { + return Ok(()); + } + if self.config.style_components.grid() && (self.content_type.is_some_and(|c| c.is_text()) || self.config.show_nonprintable From 26118afde0ad5459db4e7b61c0d91739f84726e1 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:44:39 +0800 Subject: [PATCH 22/43] docs: add changelog entry for --quiet-empty flag --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6e1ae81..f9e1c525 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Features +- Add `--quiet-empty` (`-E`) flag to suppress output when input is empty, see #1936 (@NORMAL-EX) - Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk) ## Bugfixes From 6a7936a26fa8e941d9fe3035dbae596b2dd57991 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:45:46 +0800 Subject: [PATCH 23/43] test: add integration tests for --quiet-empty flag --- tests/integration_tests.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 250b3d2e..7b4e2df4 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -3654,3 +3654,33 @@ fn plain_with_sized_terminal_width() { .stdout("hello \nworld\n") .stderr(""); } + +#[test] +fn quiet_empty_suppresses_output_on_empty_stdin() { + bat() + .arg("--quiet-empty") + .write_stdin("") + .assert() + .success() + .stdout(""); +} + +#[test] +fn quiet_empty_does_not_affect_non_empty_input() { + bat() + .arg("--quiet-empty") + .write_stdin("hello\n") + .assert() + .success() + .stdout("hello\n"); +} + +#[test] +fn quiet_empty_suppresses_output_on_empty_file() { + bat() + .arg("--quiet-empty") + .arg("empty.txt") + .assert() + .success() + .stdout(""); +} From edb8342eab8eaae3b467b1657b49168ac0f58771 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:48:03 +0800 Subject: [PATCH 24/43] docs: fix changelog entry to reference PR number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e1c525..9934329f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## Features -- Add `--quiet-empty` (`-E`) flag to suppress output when input is empty, see #1936 (@NORMAL-EX) +- Add `--quiet-empty` (`-E`) flag to suppress output when input is empty. Closes #1936, see #3563 (@NORMAL-EX) - Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk) ## Bugfixes From 2030ffa66426cc0e0c65b5df44f4d944a8875491 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 17:02:12 +0800 Subject: [PATCH 25/43] docs: update short-help.txt with --quiet-empty flag --- doc/short-help.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/short-help.txt b/doc/short-help.txt index d67a51d0..3c58a057 100644 --- a/doc/short-help.txt +++ b/doc/short-help.txt @@ -23,6 +23,8 @@ Options: Specify the name to display for a file. -d, --diff Only show lines that have been added/removed/modified. + -E, --quiet-empty + Produce no output when the input is empty. --tabs Set the tab width to T spaces. --wrap From 3aaec8cb3ba3c7187933d5b243ef35188955d312 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 17:02:24 +0800 Subject: [PATCH 26/43] docs: update long-help.txt with --quiet-empty flag --- doc/long-help.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/long-help.txt b/doc/long-help.txt index 8cb60812..023fa593 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -57,6 +57,10 @@ Options: --diff-context Include N lines of context around added/removed/modified lines when using '--diff'. + -E, --quiet-empty + When this flag is set, bat will produce no output at all when the input is empty. This is + useful when piping commands that may produce empty output, like 'git diff'. + --tabs Set the tab width to T spaces. Use a width of 0 to pass tabs through directly From 593cf768110cf51cc47b8126883156342ffb31ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 03:03:36 +0000 Subject: [PATCH 27/43] build(deps): bump git2 from 0.20.2 to 0.20.3 Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.20.2 to 0.20.3. - [Changelog](https://github.com/rust-lang/git2-rs/blob/git2-0.20.3/CHANGELOG.md) - [Commits](https://github.com/rust-lang/git2-rs/compare/git2-0.20.2...git2-0.20.3) --- updated-dependencies: - dependency-name: git2 dependency-version: 0.20.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10607f7e..aafd0d80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -658,9 +658,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" +checksum = "3e2b37e2f62729cdada11f0e6b3b6fe383c69c29fc619e391223e12856af308c" dependencies = [ "bitflags", "libc", @@ -915,9 +915,9 @@ checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "libgit2-sys" -version = "0.18.2+1.9.1" +version = "0.18.3+1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" +checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" dependencies = [ "cc", "libc", From cb83b8fb9a4077b3235c67d9babf209c92114429 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 11:47:24 +0800 Subject: [PATCH 28/43] fix: correct position of --quiet-empty in short-help.txt --- doc/short-help.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/short-help.txt b/doc/short-help.txt index 3c58a057..41a0fdee 100644 --- a/doc/short-help.txt +++ b/doc/short-help.txt @@ -23,8 +23,6 @@ Options: Specify the name to display for a file. -d, --diff Only show lines that have been added/removed/modified. - -E, --quiet-empty - Produce no output when the input is empty. --tabs Set the tab width to T spaces. --wrap @@ -62,6 +60,8 @@ Options: Display all supported languages. --completion Show shell completion for a certain shell. [possible values: bash, fish, zsh, ps1] + -E, --quiet-empty + Produce no output when the input is empty. -h, --help Print help (see more with '--help') -V, --version From fa66d8e3efaa0760ab1a2800471659c6e19c769b Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 11:48:10 +0800 Subject: [PATCH 29/43] fix: correct position of --quiet-empty in long-help.txt --- doc/long-help.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/long-help.txt b/doc/long-help.txt index 023fa593..994a3810 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -57,10 +57,6 @@ Options: --diff-context Include N lines of context around added/removed/modified lines when using '--diff'. - -E, --quiet-empty - When this flag is set, bat will produce no output at all when the input is empty. This is - useful when piping commands that may produce empty output, like 'git diff'. - --tabs Set the tab width to T spaces. Use a width of 0 to pass tabs through directly @@ -216,6 +212,10 @@ Options: --diagnostic Show diagnostic information for bug reports. + -E, --quiet-empty + When this flag is set, bat will produce no output at all when the input is empty. This is + useful when piping commands that may produce empty output, like 'git diff'. + --acknowledgements Show acknowledgements. From cddfad83e4b593fe630c4874394cda3d98c1c804 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 03:49:22 +0000 Subject: [PATCH 30/43] build(deps): bump clap from 4.5.46 to 4.5.56 Bumps [clap](https://github.com/clap-rs/clap) from 4.5.46 to 4.5.56. - [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.46...clap_complete-v4.5.56) --- updated-dependencies: - dependency-name: clap dependency-version: 4.5.56 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aafd0d80..24cfbf3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -252,18 +252,18 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.46" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c5e4fcf9c21d2e544ca1ee9d8552de13019a42aa7dbf32747fa7aaf1df76e57" +checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.46" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fecb53a0e6fcfb055f686001bc2e2592fa527efaf38dbe81a6a9563562e57d41" +checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0" dependencies = [ "anstream", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index 828520b9..7a61a4d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,7 +87,7 @@ default-features = false features = ["parsing"] [dependencies.clap] -version = "4.5.46" +version = "4.5.56" optional = true features = ["wrap_help", "cargo"] @@ -123,7 +123,7 @@ toml = { version = "0.9.8", features = ["preserve_order"] } walkdir = "2.5" [build-dependencies.clap] -version = "4.5.46" +version = "4.5.56" optional = true features = ["wrap_help", "cargo"] From c3c19c801804590b363a307fd94285af8fe9e082 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 04:19:31 +0000 Subject: [PATCH 31/43] build(deps): bump serde_with from 3.15.1 to 3.16.1 Bumps [serde_with](https://github.com/jonasbb/serde_with) from 3.15.1 to 3.16.1. - [Release notes](https://github.com/jonasbb/serde_with/releases) - [Commits](https://github.com/jonasbb/serde_with/compare/v3.15.1...v3.16.1) --- updated-dependencies: - dependency-name: serde_with dependency-version: 3.16.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24cfbf3d..fe97f975 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1415,9 +1415,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.15.1" +version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa66c845eee442168b2c8134fec70ac50dc20e760769c8ba0ad1319ca1959b04" +checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7" dependencies = [ "serde_core", "serde_with_macros", @@ -1425,9 +1425,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.15.1" +version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91a903660542fced4e99881aa481bdbaec1634568ee02e0b8bd57c64cb38955" +checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ "darling", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 7a61a4d5..0032a697 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,7 +117,7 @@ quote = "1.0.40" regex = "1.12.2" serde = "1.0" serde_derive = "1.0" -serde_with = { version = "3.15.1", default-features = false, features = ["macros"] } +serde_with = { version = "3.16.1", default-features = false, features = ["macros"] } syn = { version = "2.0.104", features = ["full"] } toml = { version = "0.9.8", features = ["preserve_order"] } walkdir = "2.5" From b396ab865f4890db32e024457f742c36f3228457 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 04:54:36 +0000 Subject: [PATCH 32/43] build(deps): bump proc-macro2 from 1.0.103 to 1.0.106 Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.103 to 1.0.106. - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.103...1.0.106) --- updated-dependencies: - dependency-name: proc-macro2 dependency-version: 1.0.106 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe97f975..30e1f1f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1217,9 +1217,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] diff --git a/Cargo.toml b/Cargo.toml index 0032a697..4e33c810 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ indexmap = { version = "2.8.0", features = ["serde"] } itertools = "0.14.0" once_cell = "1.20" prettyplease = "0.2.37" -proc-macro2 = "1.0.103" +proc-macro2 = "1.0.106" quote = "1.0.40" regex = "1.12.2" serde = "1.0" From 8f6f5dfbd207de9f79461e73d8de4f668bfc2f9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 05:19:49 +0000 Subject: [PATCH 33/43] build(deps): bump indexmap from 2.12.1 to 2.13.0 Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.12.1 to 2.13.0. - [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md) - [Commits](https://github.com/indexmap-rs/indexmap/compare/2.12.1...2.13.0) --- updated-dependencies: - dependency-name: indexmap dependency-version: 2.13.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 30e1f1f7..384b771b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -861,9 +861,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", diff --git a/Cargo.toml b/Cargo.toml index 4e33c810..c4bd2e2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,7 +108,7 @@ nix = { version = "0.30", default-features = false, features = ["term"] } [build-dependencies] anyhow = "1.0.97" -indexmap = { version = "2.8.0", features = ["serde"] } +indexmap = { version = "2.13.0", features = ["serde"] } itertools = "0.14.0" once_cell = "1.20" prettyplease = "0.2.37" From 55306c15a6dbde159fea5cc66d048b2d2f7bd283 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 16:20:27 +0800 Subject: [PATCH 34/43] docs: add --quiet-empty to man page --- assets/manual/bat.1.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/manual/bat.1.in b/assets/manual/bat.1.in index 0be4bb63..ff4cb76f 100644 --- a/assets/manual/bat.1.in +++ b/assets/manual/bat.1.in @@ -282,6 +282,10 @@ Show bat's cache directory. .IP Show diagnostic information for bug reports. .HP +\fB\-\-quiet\-empty\fR +.IP +Do not produce any output when the input is empty (e.g. an empty file or empty stdin). This is useful in scripts where silent behavior is preferred for empty input. +.HP \fB\-\-acknowledgements\fR .IP Show acknowledgements. From bd461afd753b1a08a05696a75f7acdcd6bea04fb Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 16:20:49 +0800 Subject: [PATCH 35/43] docs: add --quiet-empty to bash completion --- assets/completions/bat.bash.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/completions/bat.bash.in b/assets/completions/bat.bash.in index 66be3985..7593df8f 100644 --- a/assets/completions/bat.bash.in +++ b/assets/completions/bat.bash.in @@ -100,6 +100,7 @@ _bat() { --lessopen | \ --no-paging | \ --diagnostic | \ + --quiet-empty | \ --acknowledgements | \ -h | --help | \ -V | --version | \ @@ -227,6 +228,7 @@ _bat() { --lessopen --completion --diagnostic + --quiet-empty --acknowledgements --set-terminal-title --help From 93411a96e4c37f164b87b123774c6c9b447021e4 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 16:21:05 +0800 Subject: [PATCH 36/43] docs: add --quiet-empty to zsh completion --- assets/completions/bat.zsh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/completions/bat.zsh.in b/assets/completions/bat.zsh.in index 910ec9d0..da9a66e6 100644 --- a/assets/completions/bat.zsh.in +++ b/assets/completions/bat.zsh.in @@ -62,6 +62,7 @@ _{{PROJECT_EXECUTABLE}}_main() { --completion='[show shell completion for a certain shell]:shell:(bash fish zsh ps1)' --set-terminal-title'[sets terminal title to filenames when using a pager]' --diagnostic'[show diagnostic information for bug reports]' + --quiet-empty'[do not produce any output when the input is empty]' -P'[disable paging]' "--no-config[don't use the configuration file]" "--no-custom-assets[don't load custom assets]" From 9a5519057cb8ad3e92fc761c090e968c925a68ee Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 16:21:22 +0800 Subject: [PATCH 37/43] docs: add --quiet-empty to fish completion --- assets/completions/bat.fish.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/completions/bat.fish.in b/assets/completions/bat.fish.in index 09f6407b..21c07adf 100644 --- a/assets/completions/bat.fish.in +++ b/assets/completions/bat.fish.in @@ -61,7 +61,7 @@ function __bat_no_excl_args -s V -l version \ -l acknowledgements \ -l config-dir -l config-file \ - -l diagnostic \ + -l diagnostic -l quiet-empty \ -l list-languages -l list-themes end @@ -159,6 +159,7 @@ complete -c $bat -l config-file -f -d "Display location of configuration file" - complete -c $bat -l decorations -x -a "$decorations_opts" -d "When to use --style decorations" -n __bat_no_excl_args complete -c $bat -l diagnostic -d "Print diagnostic info for bug reports" -n __fish_is_first_arg +complete -c $bat -l quiet-empty -d "Do not produce any output when the input is empty" -n __fish_is_first_arg complete -c $bat -s d -l diff -d "Only show lines with Git changes" -n __bat_no_excl_args From 3b34b47d5555e52189abd77b508e4b29d3b84a08 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sun, 1 Feb 2026 16:21:38 +0800 Subject: [PATCH 38/43] docs: add --quiet-empty to PowerShell completion --- assets/completions/_bat.ps1.in | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/completions/_bat.ps1.in b/assets/completions/_bat.ps1.in index a9b3bcd5..db10302a 100644 --- a/assets/completions/_bat.ps1.in +++ b/assets/completions/_bat.ps1.in @@ -186,6 +186,7 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script [CompletionResult]::new('--acknowledgements' , 'acknowledgements' , [CompletionResultType]::ParameterName, 'Show acknowledgements.') [CompletionResult]::new('--set-terminal-title' , 'set-terminal-title' , [CompletionResultType]::ParameterName, 'Sets terminal title to filenames when using a pager.') [CompletionResult]::new('--diagnostic' , 'diagnostic' , [CompletionResultType]::ParameterName, 'Show diagnostic information for bug reports.') + [CompletionResult]::new('--quiet-empty' , 'quiet-empty' , [CompletionResultType]::ParameterName, 'Do not produce any output when the input is empty.') # [CompletionResult]::new('-h' , 'h' , [CompletionResultType]::ParameterName, 'Print this help message.') [CompletionResult]::new('--help' , 'help' , [CompletionResultType]::ParameterName, 'Print this help message.') # [CompletionResult]::new('-V' , 'V' , [CompletionResultType]::ParameterName, 'Show version information.') From eff57943c9d8a4fbc2c2726c191f5bda94408e8b Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sun, 1 Feb 2026 14:01:19 +0100 Subject: [PATCH 39/43] Add initial flake.nix; just for develop, for now (fixes#3577) --- .envrc | 1 + .gitignore | 3 +++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index fa381206..cd2047c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.direnv/ /target/ **/*.rs.bk @@ -12,3 +13,5 @@ /assets/completions/bat.zsh /assets/manual/bat.1 /assets/metadata.yaml + + diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..b8b992e7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1769789167, + "narHash": "sha256-kKB3bqYJU5nzYeIROI82Ef9VtTbu4uA3YydSk/Bioa8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "62c8382960464ceb98ea593cb8321a2cf8f9e3e5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..262b2901 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "bat"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { self, ... }@inputs: + let + supportedSystems = [ + "x86_64-linux" # 64-bit Intel/AMD Linux + "aarch64-linux" # 64-bit ARM Linux + "aarch64-darwin" # 64-bit ARM macOS + ]; + + forEachSupportedSystem = + f: + inputs.nixpkgs.lib.genAttrs supportedSystems ( + system: + f { + inherit system; + pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }; + } + ); + in + { + devShells = forEachSupportedSystem ( + { pkgs, system }: + { + default = pkgs.mkShellNoCC { + packages = with pkgs; [ + cargo + ]; + }; + } + ); + }; +} From d19c80a7c10f33d175113cbf0c4435aeb71e5b47 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sun, 1 Feb 2026 14:09:18 +0100 Subject: [PATCH 40/43] Remove allowUnfree = true from flake.nix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 262b2901..9afacc68 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,6 @@ inherit system; pkgs = import inputs.nixpkgs { inherit system; - config.allowUnfree = true; }; } ); From 36b37e1aa56a82f16e174724206b035a7fafdf59 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sun, 1 Feb 2026 14:11:05 +0100 Subject: [PATCH 41/43] Add x86_64-darwin (Intel macOS) to flake.nix --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 9afacc68..35c8cec1 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,7 @@ "x86_64-linux" # 64-bit Intel/AMD Linux "aarch64-linux" # 64-bit ARM Linux "aarch64-darwin" # 64-bit ARM macOS + "x86_64-darwin" # 64-bit Intel macOS ]; forEachSupportedSystem = From 2c682ff6a62b00ab88c454a3226f15df23526d35 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sun, 1 Feb 2026 14:13:03 +0100 Subject: [PATCH 42/43] docs: Document flake.nix in CHANGELOG.md (see #3577) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9934329f..214b1754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Features +- Added an initial `flake.nix` for a ready made development environment; see #3577 (@vorburger) - Add `--quiet-empty` (`-E`) flag to suppress output when input is empty. Closes #1936, see #3563 (@NORMAL-EX) - Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk) From 3f12b1c1ab247b18ec3778f34eca4fd636bf4944 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sun, 1 Feb 2026 14:20:40 +0100 Subject: [PATCH 43/43] docs: Use PR not Issue ID in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 214b1754..31e50d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## Features -- Added an initial `flake.nix` for a ready made development environment; see #3577 (@vorburger) +- Added an initial `flake.nix` for a ready made development environment; see #3578 (@vorburger) - Add `--quiet-empty` (`-E`) flag to suppress output when input is empty. Closes #1936, see #3563 (@NORMAL-EX) - Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk)