mirror of
https://github.com/nushell/nushell.git
synced 2025-05-29 22:29:06 +02:00
fix std help (#12943)
# Description Fixes: #12941 ~~The issue is cause by some columns(is_builtin, is_plugin, is_custom, is_keyword) are removed in #10023~~ Edit: I'm wrong # Tests + Formatting Added one test for `std help`
This commit is contained in:
parent
2612a167e3
commit
f53aa6fcbf
@ -515,7 +515,7 @@ def build-command-page [command: record] {
|
|||||||
$"- (ansi cyan)does not create(ansi reset) a scope."
|
$"- (ansi cyan)does not create(ansi reset) a scope."
|
||||||
}
|
}
|
||||||
) | append (
|
) | append (
|
||||||
if ($command.is_builtin) {
|
if ($command.type == "built-in") {
|
||||||
$"- (ansi cyan)is(ansi reset) a built-in command."
|
$"- (ansi cyan)is(ansi reset) a built-in command."
|
||||||
} else {
|
} else {
|
||||||
$"- (ansi cyan)is not(ansi reset) a built-in command."
|
$"- (ansi cyan)is not(ansi reset) a built-in command."
|
||||||
@ -527,19 +527,19 @@ def build-command-page [command: record] {
|
|||||||
$"- (ansi cyan)is not(ansi reset) a subcommand."
|
$"- (ansi cyan)is not(ansi reset) a subcommand."
|
||||||
}
|
}
|
||||||
) | append (
|
) | append (
|
||||||
if ($command.is_plugin) {
|
if ($command.type == "plugin") {
|
||||||
$"- (ansi cyan)is part(ansi reset) of a plugin."
|
$"- (ansi cyan)is part(ansi reset) of a plugin."
|
||||||
} else {
|
} else {
|
||||||
$"- (ansi cyan)is not part(ansi reset) of a plugin."
|
$"- (ansi cyan)is not part(ansi reset) of a plugin."
|
||||||
}
|
}
|
||||||
) | append (
|
) | append (
|
||||||
if ($command.is_custom) {
|
if ($command.type == "custom") {
|
||||||
$"- (ansi cyan)is(ansi reset) a custom command."
|
$"- (ansi cyan)is(ansi reset) a custom command."
|
||||||
} else {
|
} else {
|
||||||
$"- (ansi cyan)is not(ansi reset) a custom command."
|
$"- (ansi cyan)is not(ansi reset) a custom command."
|
||||||
}
|
}
|
||||||
) | append (
|
) | append (
|
||||||
if ($command.is_keyword) {
|
if ($command.type == "keyword") {
|
||||||
$"- (ansi cyan)is(ansi reset) a keyword."
|
$"- (ansi cyan)is(ansi reset) a keyword."
|
||||||
} else {
|
} else {
|
||||||
$"- (ansi cyan)is not(ansi reset) a keyword."
|
$"- (ansi cyan)is not(ansi reset) a keyword."
|
||||||
@ -689,7 +689,7 @@ export def commands [
|
|||||||
...command: string@"nu-complete list-commands" # the name of command to get help on
|
...command: string@"nu-complete list-commands" # the name of command to get help on
|
||||||
--find (-f): string # string to find in command names and usage
|
--find (-f): string # string to find in command names and usage
|
||||||
] {
|
] {
|
||||||
let commands = (scope commands | where not is_extern | reject is_extern | sort-by name)
|
let commands = (scope commands | sort-by name)
|
||||||
|
|
||||||
if not ($find | is-empty) {
|
if not ($find | is-empty) {
|
||||||
# TODO: impl find for external commands
|
# TODO: impl find for external commands
|
||||||
|
9
crates/nu-std/tests/test_help.nu
Normal file
9
crates/nu-std/tests/test_help.nu
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use std assert
|
||||||
|
use std help
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
def show_help_on_commands [] {
|
||||||
|
let help_result = (help alias)
|
||||||
|
assert ("item not found" not-in $help_result)
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user