Skip to content

Commit

Permalink
add nothing -> table to format date (#11290)
Browse files Browse the repository at this point in the history
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
   ╰────
```
  • Loading branch information
amtoine committed Dec 11, 2023
1 parent ecb3b3a commit 4763801
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/nu-command/src/strings/format/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl Command for FormatDate {
.input_output_types(vec![
(Type::Date, Type::String),
(Type::String, Type::String),
(Type::Nothing, Type::Table(vec![])),
])
.allow_variants_without_examples(true) // https://github.com/nushell/nushell/issues/7032
.switch("list", "lists strftime cheatsheet", Some('l'))
Expand Down

0 comments on commit 4763801

Please sign in to comment.