rename from date format to format date (#9902)

# Description
Closes: #9891
I also think it's good to keep command name consistency.

And moving `date format` to deprecated.

# User-Facing Changes
Running `date format` will lead to deprecate message:
```nushell
❯ "2021-10-22 20:00:12 +01:00" | date format
Error: nu:🐚:deprecated_command

  × Deprecated command date format
   ╭─[entry #28:1:1]
 1 │ "2021-10-22 20:00:12 +01:00" | date format
   ·                                ─────┬─────
   ·                                     ╰── 'date format' is deprecated. Please use 'format date' instead.
   ╰────
```
This commit is contained in:
WindSoilder
2023-08-04 02:06:00 +08:00
committed by GitHub
parent a455e2e5eb
commit 14bf25da14
15 changed files with 551 additions and 496 deletions

View File

@ -3,7 +3,7 @@ use nu_test_support::{nu, pipeline};
#[test]
fn formatter_not_valid() {
let actual = nu!(r#"
date now | date format '%N'
date now | format date '%N'
"#);
assert!(actual.err.contains("invalid format"));
@ -12,7 +12,7 @@ fn formatter_not_valid() {
#[test]
fn fails_without_input() {
let actual = nu!(r#"
date format "%c"
format date "%c"
"#);
assert!(actual.err.contains("Pipeline empty"));
@ -24,7 +24,7 @@ fn locale_format_respect_different_locale() {
locale: "en_US",
pipeline(
r#"
"2021-10-22 20:00:12 +01:00" | date format "%c"
"2021-10-22 20:00:12 +01:00" | format date "%c"
"#
)
);
@ -34,7 +34,7 @@ fn locale_format_respect_different_locale() {
locale: "en_GB",
pipeline(
r#"
"2021-10-22 20:00:12 +01:00" | date format "%c"
"2021-10-22 20:00:12 +01:00" | format date "%c"
"#
)
);
@ -44,7 +44,7 @@ fn locale_format_respect_different_locale() {
locale: "de_DE",
pipeline(
r#"
"2021-10-22 20:00:12 +01:00" | date format "%c"
"2021-10-22 20:00:12 +01:00" | format date "%c"
"#
)
);
@ -54,7 +54,7 @@ fn locale_format_respect_different_locale() {
locale: "zh_CN",
pipeline(
r#"
"2021-10-22 20:00:12 +01:00" | date format "%c"
"2021-10-22 20:00:12 +01:00" | format date "%c"
"#
)
);
@ -64,7 +64,7 @@ fn locale_format_respect_different_locale() {
locale: "ja_JP",
pipeline(
r#"
"2021-10-22 20:00:12 +01:00" | date format "%c"
"2021-10-22 20:00:12 +01:00" | format date "%c"
"#
)
);
@ -74,7 +74,7 @@ fn locale_format_respect_different_locale() {
locale: "fr_FR",
pipeline(
r#"
"2021-10-22 20:00:12 +01:00" | date format "%c"
"2021-10-22 20:00:12 +01:00" | format date "%c"
"#
)
);