feat: update #4518, add command examples for def, do, cp, mv, mkdir and ls (#4528)

This commit is contained in:
Justin Ma
2022-02-18 22:30:16 +08:00
committed by GitHub
parent a967854332
commit dd11be03be
6 changed files with 109 additions and 7 deletions

View File

@ -5,8 +5,8 @@ use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, SyntaxShape,
Value,
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature,
SyntaxShape, Value,
};
#[derive(Clone)]
@ -77,4 +77,19 @@ impl Command for Mkdir {
.into_iter()
.into_pipeline_data(engine_state.ctrlc.clone()))
}
fn examples(&self) -> Vec<Example> {
vec![
Example {
description: "Make a directory named foo",
example: "mkdir foo",
result: None,
},
Example {
description: "Make multiple directories and show the paths created",
example: "mkdir -s foo/bar foo2",
result: None,
},
]
}
}