mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Add long options for filters (#10641)
This commit is contained in:
@ -128,7 +128,7 @@ impl Command for SubCommand {
|
||||
},
|
||||
Example {
|
||||
description: "Split a list of chars into lists based on multiple characters",
|
||||
example: r"[a, b, c, d, a, e, f, g] | split list -r '(b|e)'",
|
||||
example: r"[a, b, c, d, a, e, f, g] | split list --regex '(b|e)'",
|
||||
result: Some(Value::list(
|
||||
vec![
|
||||
Value::list(vec![Value::test_string("a")], Span::test_data()),
|
||||
|
@ -94,7 +94,7 @@ impl Command for SubCommand {
|
||||
Example {
|
||||
description:
|
||||
"A real-world example of splitting words",
|
||||
example: "http get https://www.gutenberg.org/files/11/11-0.txt | str downcase | split words -l 2 | uniq -c | sort-by count --reverse | first 10",
|
||||
example: "http get https://www.gutenberg.org/files/11/11-0.txt | str downcase | split words -l 2 | uniq --count | sort-by count --reverse | first 10",
|
||||
result: None,
|
||||
},
|
||||
]
|
||||
|
@ -115,7 +115,7 @@ impl Command for SubCommand {
|
||||
},
|
||||
Example {
|
||||
description: "Find and replace all occurrences of a substring",
|
||||
example: r#"'abc abc abc' | str replace -a 'b' 'z'"#,
|
||||
example: r#"'abc abc abc' | str replace --all 'b' 'z'"#,
|
||||
result: Some(Value::test_string("azc azc azc")),
|
||||
},
|
||||
Example {
|
||||
@ -125,13 +125,13 @@ impl Command for SubCommand {
|
||||
},
|
||||
Example {
|
||||
description: "Find and replace all occurrences of find string using regular expression",
|
||||
example: "'abc abc abc' | str replace -ar 'b' 'z'",
|
||||
example: "'abc abc abc' | str replace --all --regex 'b' 'z'",
|
||||
result: Some(Value::test_string("azc azc azc")),
|
||||
},
|
||||
Example {
|
||||
description: "Find and replace all occurrences of find string in table using regular expression",
|
||||
example:
|
||||
"[[ColA ColB ColC]; [abc abc ads]] | str replace -ar 'b' 'z' ColA ColC",
|
||||
"[[ColA ColB ColC]; [abc abc ads]] | str replace --all --regex 'b' 'z' ColA ColC",
|
||||
result: Some(Value::list (
|
||||
vec![Value::test_record(Record {
|
||||
cols: vec!["ColA".to_string(), "ColB".to_string(), "ColC".to_string()],
|
||||
@ -147,7 +147,7 @@ impl Command for SubCommand {
|
||||
Example {
|
||||
description: "Find and replace all occurrences of find string in record using regular expression",
|
||||
example:
|
||||
"{ KeyA: abc, KeyB: abc, KeyC: ads } | str replace -ar 'b' 'z' KeyA KeyC",
|
||||
"{ KeyA: abc, KeyB: abc, KeyC: ads } | str replace --all --regex 'b' 'z' KeyA KeyC",
|
||||
result: Some(Value::test_record(Record {
|
||||
cols: vec!["KeyA".to_string(), "KeyB".to_string(), "KeyC".to_string()],
|
||||
vals: vec![
|
||||
@ -179,7 +179,7 @@ impl Command for SubCommand {
|
||||
},
|
||||
Example {
|
||||
description: "Find and replace on individual lines using multiline regular expression",
|
||||
example: r#""non-matching line\n123. one line\n124. another line\n" | str replace -am '^[0-9]+\. ' ''"#,
|
||||
example: r#""non-matching line\n123. one line\n124. another line\n" | str replace --all --multiline '^[0-9]+\. ' ''"#,
|
||||
result: Some(Value::test_string("non-matching line\none line\nanother line\n")),
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user