add nothing -> table to format date (#11290)

this will allow to run
```nushell
format date --list | get 0
```
and get
```
─────────────┬───────────────────────────────────────────────────────────
Specification│%Y
Example      │2023
Description  │The full proleptic Gregorian year, zero-padded to 4 digits.
─────────────┴───────────────────────────────────────────────────────────
```
instead of currently
```
Error: nu::parser::input_type_mismatch

  × Command does not support string input.
   ╭─[entry #2:1:1]
 1 │ format date --list | get 0
   ·                      ─┬─
   ·                       ╰── command doesn't support string input
   ╰────
```
This commit is contained in:
Antoine Stevan 2023-12-11 13:21:17 +01:00 committed by GitHub
parent ecb3b3a364
commit 4763801cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ impl Command for FormatDate {
.input_output_types(vec![ .input_output_types(vec![
(Type::Date, Type::String), (Type::Date, Type::String),
(Type::String, Type::String), (Type::String, Type::String),
(Type::Nothing, Type::Table(vec![])),
]) ])
.allow_variants_without_examples(true) // https://github.com/nushell/nushell/issues/7032 .allow_variants_without_examples(true) // https://github.com/nushell/nushell/issues/7032
.switch("list", "lists strftime cheatsheet", Some('l')) .switch("list", "lists strftime cheatsheet", Some('l'))