diff --git a/rust/src/ui/cli.rs b/rust/src/ui/cli.rs index 5c770e7..945325e 100644 --- a/rust/src/ui/cli.rs +++ b/rust/src/ui/cli.rs @@ -118,13 +118,24 @@ trait Command { struct HelpCommand; impl Command for HelpCommand { fn execute(&self, cli: &mut CommandLinePanel, params: &[&str]) { - let mut keys = cli.commands.keys().cloned().collect::>(); - keys.sort(); - for key in keys { - cli.publish_message( - format!("\t- {}: {}", key, cli.commands.get(&key).unwrap().help()), - CliColor::Regular, - ); + if let Some(command_name) = params.first() { + if let Some(command) = cli.commands.get(*command_name) { + cli.publish_message(command.help().to_string(), CliColor::Regular); + } else { + cli.publish_message( + format!("Unknown command: {}", command_name), + CliColor::Regular, + ); + } + } else { + let mut keys = cli.commands.keys().cloned().collect::>(); + keys.sort(); + for key in keys { + cli.publish_message( + format!("\t- {}: {}", key, cli.commands.get(&key).unwrap().help()), + CliColor::Regular, + ); + } } }