nu_command/date/
date_.rs

1use nu_engine::{command_prelude::*, get_full_help};
2
3#[derive(Clone)]
4pub struct Date;
5
6impl Command for Date {
7    fn name(&self) -> &str {
8        "date"
9    }
10
11    fn signature(&self) -> Signature {
12        Signature::build("date")
13            .category(Category::Date)
14            .input_output_types(vec![(Type::Nothing, Type::String)])
15    }
16
17    fn description(&self) -> &str {
18        "Date-related commands."
19    }
20
21    fn extra_description(&self) -> &str {
22        "You must use one of the following subcommands. Using this command as-is will only produce this help message."
23    }
24
25    fn search_terms(&self) -> Vec<&str> {
26        vec![
27            "time",
28            "now",
29            "today",
30            "tomorrow",
31            "yesterday",
32            "weekday",
33            "weekday_name",
34            "timezone",
35        ]
36    }
37
38    fn run(
39        &self,
40        engine_state: &EngineState,
41        stack: &mut Stack,
42        call: &Call,
43        _input: PipelineData,
44    ) -> Result<PipelineData, ShellError> {
45        Ok(Value::string(get_full_help(self, engine_state, stack), call.head).into_pipeline_data())
46    }
47}