remote --help/-h from $scope.commands display (#3311)

* remote --help/-h from $scope.commands

* change a test
This commit is contained in:
Darren Schroeder 2021-04-14 07:55:58 -05:00 committed by GitHub
parent 005649b6fc
commit ea0205f2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -52,7 +52,10 @@ impl Scope {
for frame in self.frames.lock().iter().rev() {
for (name, command) in frame.commands.iter() {
if !output.contains_key(name) {
output.insert(name.clone(), command.signature());
let mut sig = command.signature();
// don't show --help and -h in the command arguments for $scope.commands
sig.remove_named("help");
output.insert(name.clone(), sig);
}
}
}

View File

@ -82,7 +82,7 @@ fn scope_variable_with_command_present() {
assert_that!(
nu.pipeline("def meaning-of-life [--number: int] { echo $number }; echo $scope.commands | get meaning-of-life"),
says().to_stdout("-h --help --number")
says().to_stdout("--number")
);
})
}