Add or update examples for some commands (#4521)

* chore: add or update examples for some commands

* chore: code formatting
This commit is contained in:
Justin Ma
2022-02-18 21:06:52 +08:00
committed by GitHub
parent 1377693f0f
commit a5f9ad2a43
8 changed files with 89 additions and 9 deletions

View File

@ -1,7 +1,7 @@
use nu_engine::{current_dir, CallExt};
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, PipelineData, ShellError, Signature, SyntaxShape, Value};
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Value};
/// Source a file for environment variables.
#[derive(Clone)]
@ -97,4 +97,19 @@ impl Command for Exit {
Ok(PipelineData::new(call.head))
}
}
fn examples(&self) -> Vec<Example> {
vec![
Example {
description: "Exit the current shell",
example: "exit",
result: None,
},
Example {
description: "Exit all shells (exiting Nu)",
example: "exit --now",
result: None,
},
]
}
}