forked from extern/nushell
Add example for command n,g,p and grid, update date now examples (#4622)
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
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, Spanned, SyntaxShape, Value};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Value,
|
||||
};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -75,4 +77,19 @@ impl Command for GotoShell {
|
||||
|
||||
Ok(PipelineData::new(call.head))
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "Make two directories and enter new shells for them, use `g` to jump to the specific shell",
|
||||
example: r#"mkdir foo bar; enter foo; enter ../bar; g 1"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Use `shells` to show all the opened shells and run `g 2` to jump to the third one",
|
||||
example: r#"shells; g 2"#,
|
||||
result: None,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use nu_engine::current_dir;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, PipelineData, ShellError, Signature, Value};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Value};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -76,4 +76,19 @@ impl Command for NextShell {
|
||||
|
||||
Ok(PipelineData::new(call.head))
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "Make two directories and enter new shells for them, use `n` to jump to the next shell",
|
||||
example: r#"mkdir foo bar; enter foo; enter ../bar; n"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Run `n` several times and note the changes of current directory",
|
||||
example: r#"n"#,
|
||||
result: None,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use nu_engine::current_dir;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, PipelineData, ShellError, Signature, Value};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Value};
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
@ -76,4 +76,19 @@ impl Command for PrevShell {
|
||||
|
||||
Ok(PipelineData::new(call.head))
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "Make two directories and enter new shells for them, use `p` to jump to the previous shell",
|
||||
example: r#"mkdir foo bar; enter foo; enter ../bar; p"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Run `p` several times and note the changes of current directory",
|
||||
example: r#"p"#,
|
||||
result: None,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user