From 4b05911fafa193864cd0e8137fc3bd8bbdb32a02 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Mon, 27 Jan 2025 16:47:12 +0100 Subject: [PATCH] bin: Handle `--no-forward` wo/ command correctly --- bin/main.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/main.rs b/bin/main.rs index 7cdb86c6..c020bfff 100644 --- a/bin/main.rs +++ b/bin/main.rs @@ -100,23 +100,29 @@ fn parse_args() -> anyhow::Result { let command = match command { Some(CommandName::Help) => { if forward { - Some(Command::Other(vec!["help".into()])) + Command::Other(vec!["help".into()]) } else { - Some(Command::Help) + Command::Help } } Some(CommandName::Version) => { if forward { - Some(Command::Other(vec!["version".into()])) + Command::Other(vec!["version".into()]) } else { - Some(Command::Version { json }) + Command::Version { json } + } + } + Some(CommandName::Other(args)) => Command::Other(args), + _ => { + if forward { + Command::Other(vec!["help".into()]) + } else { + Command::Other(vec![]) } } - Some(CommandName::Other(args)) => Some(Command::Other(args)), - _ => None, }; - Ok(command.unwrap_or_else(|| Command::Other(vec![]))) + Ok(command) } fn print_help() -> anyhow::Result<()> {