From 030d73147ec96e55be200a83d66d9123d9d059c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Tue, 3 Sep 2019 04:05:52 -0500 Subject: [PATCH] can view help for a given command by entering a command. --- src/commands/enter.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/commands/enter.rs b/src/commands/enter.rs index dda96ab2e9..7b42793e12 100644 --- a/src/commands/enter.rs +++ b/src/commands/enter.rs @@ -38,11 +38,22 @@ impl PerItemCommand for Enter { let location = location.to_string(); let location_clone = location.to_string(); - if registry.has(&location) { - Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterHelpShell( - Value::string(location_clone).tagged(Tag::unknown()), - )))] - .into()) + if location.starts_with("help") { + let spec = location.split(":").collect::>(); + + let (_, command) = (spec[0], spec[1]); + + if registry.has(command) { + Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterHelpShell( + Value::string(command).tagged(Tag::unknown()), + )))] + .into()) + } else { + Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterHelpShell( + Value::nothing().tagged(Tag::unknown()), + )))] + .into()) + } } else if PathBuf::from(location).is_dir() { Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterShell( location_clone,