Add examples for env,let-env,rm,touch and date list-timezone (#4531)

* feat: update #4518, add examples for env,let-env,rm,touch and date list-timezone

* fix typo

* update example for `date list-timezone` command
This commit is contained in:
Justin Ma
2022-02-19 00:19:37 +08:00
committed by GitHub
parent dd11be03be
commit 1235d516a5
5 changed files with 91 additions and 6 deletions

View File

@ -1,7 +1,9 @@
use chrono_tz::TZ_VARIANTS;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, IntoInterruptiblePipelineData, PipelineData, Signature, Value};
use nu_protocol::{
Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, Value,
};
#[derive(Clone)]
pub struct SubCommand;
@ -41,4 +43,19 @@ impl Command for SubCommand {
.into_iter()
.into_pipeline_data(engine_state.ctrlc.clone()))
}
fn examples(&self) -> Vec<Example> {
vec![Example {
example: "date list-timezone | where timezone =~ Shanghai",
description: "Show timezone(s) that contains 'Shanghai'",
result: Some(Value::List {
vals: vec![Value::Record {
cols: vec!["timezone".into()],
vals: vec![Value::test_string("Asia/Shanghai")],
span: Span::test_data(),
}],
span: Span::test_data(),
}),
}]
}
}