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 chrono::Local;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, IntoPipelineData, PipelineData, Signature, Value};
use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Value};
#[derive(Clone)]
pub struct SubCommand;
@ -33,4 +33,12 @@ impl Command for SubCommand {
}
.into_pipeline_data())
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Get the current date and display it in a given format string.",
example: r#"date now | date format "%Y-%m-%d %H:%M:%S""#,
result: None,
}]
}
}