nu_command/removed/
format.rs1use nu_engine::command_prelude::*;
2
3#[derive(Clone)]
4pub struct DateFormat;
5
6impl Command for DateFormat {
7 fn name(&self) -> &str {
8 "date format"
9 }
10
11 fn signature(&self) -> Signature {
12 Signature::build("date format")
13 .input_output_types(vec![
14 (Type::Date, Type::String),
15 (Type::String, Type::String),
16 ])
17 .allow_variants_without_examples(true) .switch("list", "lists strftime cheatsheet", Some('l'))
19 .optional(
20 "format string",
21 SyntaxShape::String,
22 "The desired date format.",
23 )
24 .category(Category::Removed)
25 }
26
27 fn description(&self) -> &str {
28 "Removed command: use `format date` instead."
29 }
30
31 fn run(
32 &self,
33 _engine_state: &EngineState,
34 _stack: &mut Stack,
35 call: &Call,
36 _input: PipelineData,
37 ) -> Result<PipelineData, ShellError> {
38 Err(nu_protocol::ShellError::RemovedCommand {
39 removed: self.name().to_string(),
40 replacement: "format date".to_owned(),
41 span: call.head,
42 })
43 }
44}