fix typo, update some examples and regenerate docs (#4718)

This commit is contained in:
Justin Ma
2022-03-04 20:10:09 +08:00
committed by GitHub
parent eeef9f27eb
commit 1157fcf372
347 changed files with 436 additions and 374 deletions

View File

@ -48,7 +48,7 @@ impl Command for Rm {
)
.switch("recursive", "delete subdirectories recursively", Some('r'))
.switch("force", "suppress error when no file", Some('f'))
.switch("quiet", "supress output showing files deleted", Some('q'))
.switch("quiet", "suppress output showing files deleted", Some('q'))
// .switch("interactive", "ask user to confirm action", Some('i'))
.rest(
"rest",

View File

@ -81,7 +81,7 @@ impl Command for Each {
},
Example {
example: r#"[1 2 3] | each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }"#,
description: "Iterate over each element, print the matching value and it's index",
description: "Iterate over each element, print the matching value and its index",
result: Some(Value::List {
vals: vec![Value::String {
val: "found 2 at 1!".to_string(),

View File

@ -39,7 +39,7 @@ impl Command for ParEach {
},
Example {
example: r#"[1 2 3] | par-each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }"#,
description: "Iterate over each element, print the matching value and it's index",
description: "Iterate over each element, print the matching value and its index",
result: Some(Value::List {
vals: vec![Value::String {
val: "found 2 at 1!".to_string(),

View File

@ -32,7 +32,7 @@ impl Command for ParEachGroup {
fn examples(&self) -> Vec<Example> {
vec![Example {
example: "echo [1 2 3 4] | par-each group 2 { $it.0 + $it.1 }",
example: "echo [1 2 3 4] | par-each group 2 {|it| $it.0 + $it.1 }",
description: "Multiplies elements in list",
result: None,
}]

View File

@ -40,7 +40,7 @@ impl Command for SubCommand {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Evalulate math in the pipeline",
description: "Evaluate math in the pipeline",
example: "'10 / 4' | math eval",
result: Some(Value::Float {
val: 2.5,

View File

@ -283,7 +283,7 @@ Format: #
)),
},
Example {
description: "Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purble bold 'World')",
description: "Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purple bold 'World')",
example: r#"echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect"#,
result: Some(Value::test_string(
"\u{1b}[3;93;41mHello\u{1b}[0m \u{1b}[1;32mNu \u{1b}[1;35mWorld\u{1b}[0m",

View File

@ -41,11 +41,28 @@ impl Command for Ps {
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "List the system processes",
example: "ps",
result: None,
}]
vec![
Example {
description: "List the system processes",
example: "ps",
result: None,
},
Example {
description: "List the top 5 system processes with the highest memory usage",
example: "ps | sort-by mem | last 5",
result: None,
},
Example {
description: "List the top 3 system processes with the highest CPU usage",
example: "ps | sort-by cpu | last 3",
result: None,
},
Example {
description: "List the system processes with 'nu' in their names",
example: "ps | where name =~ 'nu'",
result: None,
},
]
}
}

View File

@ -36,7 +36,7 @@ fn sets_block_run_value_for_an_empty_column() {
[ Jason, Gedge, 10/11/2013, 1 ]
[ Yehuda, Katz, 10/11/2013, '' ]
]
| empty? likes -b { 1 }
| empty? likes -b {|_| 1 }
| get likes
| math sum
"#

View File

@ -33,7 +33,7 @@ fn error_when_invalid_character_set_given() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 'username:password' | hash base64 --character_set 'this is invalid' --encode
echo 'username:password' | hash base64 --character-set 'this is invalid' --encode
"#
)
);
@ -50,7 +50,7 @@ fn base64_decode_characterset_binhex() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo "F@0NEPjJD97kE'&bEhFZEP3" | hash base64 --character_set binhex --decode
echo "F@0NEPjJD97kE'&bEhFZEP3" | hash base64 --character-set binhex --decode
"#
)
);