mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
can view help for a given command by entering a command.
This commit is contained in:
parent
a449d2c005
commit
030d73147e
1 changed files with 16 additions and 5 deletions
|
@ -38,11 +38,22 @@ impl PerItemCommand for Enter {
|
||||||
let location = location.to_string();
|
let location = location.to_string();
|
||||||
let location_clone = location.to_string();
|
let location_clone = location.to_string();
|
||||||
|
|
||||||
if registry.has(&location) {
|
if location.starts_with("help") {
|
||||||
|
let spec = location.split(":").collect::<Vec<&str>>();
|
||||||
|
|
||||||
|
let (_, command) = (spec[0], spec[1]);
|
||||||
|
|
||||||
|
if registry.has(command) {
|
||||||
Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterHelpShell(
|
Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterHelpShell(
|
||||||
Value::string(location_clone).tagged(Tag::unknown()),
|
Value::string(command).tagged(Tag::unknown()),
|
||||||
)))]
|
)))]
|
||||||
.into())
|
.into())
|
||||||
|
} else {
|
||||||
|
Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterHelpShell(
|
||||||
|
Value::nothing().tagged(Tag::unknown()),
|
||||||
|
)))]
|
||||||
|
.into())
|
||||||
|
}
|
||||||
} else if PathBuf::from(location).is_dir() {
|
} else if PathBuf::from(location).is_dir() {
|
||||||
Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterShell(
|
Ok(vec![Ok(ReturnSuccess::Action(CommandAction::EnterShell(
|
||||||
location_clone,
|
location_clone,
|
||||||
|
|
Loading…
Reference in a new issue