Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
bin: Handle `--no-forward` wo/ command correctly
Erik Kundt committed 1 year ago
commit 4b05911fafa193864cd0e8137fc3bd8bbdb32a02
parent 8d693a6
1 file changed +13 -7
modified bin/main.rs
@@ -100,23 +100,29 @@ fn parse_args() -> anyhow::Result<Command> {
    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<()> {