docs: clarify print and echo commands (#5909)

I thought this comment was relevant:
https://github.com/nushell/nushell/issues/5724#issuecomment-1148164153
This commit is contained in:
Benoît Cortier 2022-06-29 18:43:46 -04:00 committed by GitHub
parent 7aabc381a3
commit 1c15a4ed3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -25,7 +25,14 @@ impl Command for Print {
}
fn usage(&self) -> &str {
"Prints the values given"
"Print the given values to stdout"
}
fn extra_usage(&self) -> &str {
r#"Unlike `echo`, this command does not return any value (`print | describe` will return "nothing").
Since this command has no output, there is no point in piping it with other commands.
`print` may be used inside blocks of code (e.g.: hooks) to display text during execution without interfering with the pipeline."#
}
fn search_terms(&self) -> Vec<&str> {

View File

@ -23,6 +23,10 @@ impl Command for Echo {
.category(Category::Core)
}
fn extra_usage(&self) -> &str {
"Unlike `print`, this command returns an actual value that will be passed to the next command of the pipeline."
}
fn run(
&self,
engine_state: &EngineState,