diff --git a/crates/nu-cli/src/commands/where_.rs b/crates/nu-cli/src/commands/where_.rs index eb9fd2ae7..57145232e 100644 --- a/crates/nu-cli/src/commands/where_.rs +++ b/crates/nu-cli/src/commands/where_.rs @@ -57,7 +57,7 @@ impl WholeStreamCommand for Where { }, Example { description: "List all files that were modified in the last two months", - example: "ls | where modified <= 2M", + example: "ls | where modified <= 2mon", result: None, }, ] diff --git a/crates/nu-cli/tests/commands/math/mod.rs b/crates/nu-cli/tests/commands/math/mod.rs index 10ef1bb28..2db1fbe56 100644 --- a/crates/nu-cli/tests/commands/math/mod.rs +++ b/crates/nu-cli/tests/commands/math/mod.rs @@ -166,11 +166,11 @@ fn duration_math() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( r#" - = 1w + 1d + = 1wk + 1day "# )); - assert_eq!(actual.out, "8d"); + assert_eq!(actual.out, "8day"); } #[test] @@ -178,11 +178,11 @@ fn duration_math_with_nanoseconds() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( r#" - = 1w + 10ns + = 1wk + 10ns "# )); - assert_eq!(actual.out, "7d 10ns"); + assert_eq!(actual.out, "7day 10ns"); } #[test] @@ -190,11 +190,11 @@ fn duration_math_with_negative() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( r#" - = 1d - 1w + = 1day - 1wk "# )); - assert_eq!(actual.out, "-6d"); + assert_eq!(actual.out, "-6day"); } #[test] diff --git a/crates/nu-cli/tests/format_conversions/html.rs b/crates/nu-cli/tests/format_conversions/html.rs index 6094cb83c..42311ffdc 100644 --- a/crates/nu-cli/tests/format_conversions/html.rs +++ b/crates/nu-cli/tests/format_conversions/html.rs @@ -86,6 +86,6 @@ fn test_html_color_where_flag_dark_false() { ); assert_eq!( actual.out, - r"Filter table to match the condition.

Usage:
> where <condition> {flags}

Parameters:
<condition> the condition that must match

Flags:
-h, --help: Display this help message

Examples:
List all files in the current directory with sizes greater than 2kb
> ls | where size > 2kb

List only the files in the current directory
>
ls
| where type == File

List all files with names that contain "Car"
>
ls
| where name =~ "Car"

List all files that were modified in the last two months
>
ls
| where modified <= 2M

" + r"Filter table to match the condition.

Usage:
> where <condition> {flags}

Parameters:
<condition> the condition that must match

Flags:
-h, --help: Display this help message

Examples:
List all files in the current directory with sizes greater than 2kb
> ls | where size > 2kb

List only the files in the current directory
>
ls
| where type == File

List all files with names that contain "Car"
>
ls
| where name =~ "Car"

List all files that were modified in the last two months
>
ls
| where modified <= 2mon

" ); } diff --git a/crates/nu-parser/src/parse.rs b/crates/nu-parser/src/parse.rs index 348dd3017..b600fe986 100644 --- a/crates/nu-parser/src/parse.rs +++ b/crates/nu-parser/src/parse.rs @@ -316,13 +316,13 @@ fn parse_unit(lite_arg: &Spanned) -> (SpannedExpression, Option "ns", Unit::Microsecond => "us", Unit::Millisecond => "ms", - Unit::Second => "s", - Unit::Minute => "m", - Unit::Hour => "h", - Unit::Day => "d", - Unit::Week => "w", - Unit::Month => "M", - Unit::Year => "y", + Unit::Second => "sec", + Unit::Minute => "min", + Unit::Hour => "hr", + Unit::Day => "day", + Unit::Week => "wk", + Unit::Month => "mon", + Unit::Year => "yr", } } diff --git a/crates/nu-protocol/src/value/primitive.rs b/crates/nu-protocol/src/value/primitive.rs index d4a5dbcc1..34443ebf6 100644 --- a/crates/nu-protocol/src/value/primitive.rs +++ b/crates/nu-protocol/src/value/primitive.rs @@ -302,19 +302,19 @@ pub fn format_duration(duration: &BigInt) -> String { let mut output_prep = vec![]; if !days.is_zero() { - output_prep.push(format!("{}d", days)); + output_prep.push(format!("{}day", days)); } if !hours.is_zero() { - output_prep.push(format!("{}h", hours)); + output_prep.push(format!("{}hr", hours)); } if !mins.is_zero() { - output_prep.push(format!("{}m", mins)); + output_prep.push(format!("{}min", mins)); } if !secs.is_zero() { - output_prep.push(format!("{}s", secs)); + output_prep.push(format!("{}sec", secs)); } if !millis.is_zero() {