From 53a10e0b0a93d3979bf3c6a641f353b5156914a6 Mon Sep 17 00:00:00 2001 From: dddffgg Date: Sat, 31 Jan 2026 16:41:13 +0800 Subject: [PATCH] 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")