Update docs for open and decode command, regenerate all docs (#4815)

* Update docs for open and decode command, regenerate all docs

* Update open.rs

* Update open.md

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
This commit is contained in:
Justin Ma
2022-03-11 18:39:54 +08:00
committed by GitHub
parent 7debb27d78
commit f3626f7c3a
8 changed files with 59 additions and 21 deletions

View File

@ -20,7 +20,7 @@ impl Command for Open {
}
fn usage(&self) -> &str {
"Opens a file."
"Load a file into a cell, converting to table if possible (avoid by appending '--raw')."
}
fn signature(&self) -> nu_protocol::Signature {
@ -172,6 +172,11 @@ impl Command for Open {
example: "echo 'myfile.txt' | open",
result: None,
},
Example {
description: "Open a file, and decode it by the specified encoding",
example: "open myfile.txt --raw | decode utf-8",
result: None,
},
]
}
}

View File

@ -25,6 +25,14 @@ impl Command for Decode {
.category(Category::Strings)
}
fn extra_usage(&self) -> &str {
r#"Multiple encodings are supported, here is an example of a few:
big5, euc-jp, euc-kr, gbk, iso-8859-1, utf-16, cp1252, latin5
For a more complete list of encodings please refer to the encoding_rs
documentation link at https://docs.rs/encoding_rs/0.8.28/encoding_rs/#statics"#
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Decode the output of an external command",