Improve internal documentation of save command (#5704)

- Example for `--append` mode.
- Search terms for redirection
This commit is contained in:
Stefan Holderbach 2022-06-03 11:35:31 +02:00 committed by GitHub
parent 7a9bf06005
commit a75318d7e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,16 @@ impl Command for Save {
}
fn search_terms(&self) -> Vec<&str> {
vec!["save", "write", "write_file"]
vec![
"write",
"write_file",
"append",
"redirection",
"file",
"io",
">",
">>",
]
}
fn signature(&self) -> nu_protocol::Signature {
@ -214,12 +223,17 @@ impl Command for Save {
fn examples(&self) -> Vec<Example> {
vec![
Example {
description: "Save a string to foo.txt in current directory",
description: "Save a string to foo.txt in the current directory",
example: r#"echo 'save me' | save foo.txt"#,
result: None,
},
Example {
description: "Save a record to foo.json in current directory",
description: "Append a string to the end of foo.txt",
example: r#"echo 'append me' | save --append foo.txt"#,
result: None,
},
Example {
description: "Save a record to foo.json in the current directory",
example: r#"echo { a: 1, b: 2 } | save foo.json"#,
result: None,
},