From 4500605bca56b746e52764f88315d4a66dac2817 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sat, 24 Aug 2024 08:36:10 -0400 Subject: [PATCH] Don't use a pager for --version (#1824) --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index a0df151ae..4855dcc5c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,7 @@ mod subcommands; mod tests; -use std::io::{self, ErrorKind, IsTerminal}; +use std::io::{self, ErrorKind, IsTerminal, Write}; use std::process; use bytelines::ByteLinesReader; @@ -80,7 +80,11 @@ fn run_app() -> std::io::Result { let opt = cli::Opt::from_args_and_git_config(&env, assets); let opt = match opt { - Call::Help(msg) | Call::Version(msg) => { + Call::Version(msg) => { + writeln!(std::io::stdout(), "{}", msg.trim_end())?; + return Ok(0); + } + Call::Help(msg) => { OutputType::oneshot_write(msg)?; return Ok(0); }