From a75318d7e8bc8d88043d2e982b26dcb58308acb6 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Fri, 3 Jun 2022 11:35:31 +0200 Subject: [PATCH] Improve internal documentation of `save` command (#5704) - Example for `--append` mode. - Search terms for redirection --- crates/nu-command/src/filesystem/save.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/filesystem/save.rs b/crates/nu-command/src/filesystem/save.rs index fceed050d6..0587f799cf 100644 --- a/crates/nu-command/src/filesystem/save.rs +++ b/crates/nu-command/src/filesystem/save.rs @@ -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 { 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, },