mirror of
https://github.com/nushell/nushell.git
synced 2025-04-17 09:48:19 +02:00
Adjust examples in date commands (#12055)
Hello! This is my first PR to nushell, as I was looking at things for #5066. The usage text for the date commands seemed fine to me, so this is just a bit of a tidy up of the examples, mostly the description text. # Description - Remove two incorrect examples for `date to-record` and `date to-table` where nothing was piped in (which causes an error in actual use). - Fix misleading descriptions in `date to-timezone` which erroneously referred to Hawaii's time zone. - Standardise on "time zone" in written descriptions. - Generally tidy up example descriptions and improve consistency. # User-Facing Changes Only in related help text showing examples.
This commit is contained in:
parent
3ee2fc60f9
commit
71aacf5032
@ -51,7 +51,7 @@ impl Command for SubCommand {
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![Example {
|
||||
example: "date list-timezone | where timezone =~ Shanghai",
|
||||
description: "Show timezone(s) that contains 'Shanghai'",
|
||||
description: "Show time zone(s) that contains 'Shanghai'",
|
||||
result: Some(Value::test_list(vec![Value::test_record(record! {
|
||||
"timezone" => Value::test_string("Asia/Shanghai"),
|
||||
})])),
|
||||
|
@ -46,17 +46,17 @@ impl Command for SubCommand {
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get the time duration from 2019-04-30 to now",
|
||||
description: "Get the time duration since 2019-04-30.",
|
||||
example: r#"(date now) - 2019-05-01"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get the time duration since a more accurate time",
|
||||
description: "Get the time duration since a more specific time.",
|
||||
example: r#"(date now) - 2019-05-01T04:12:05.20+08:00"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get current time in full RFC3339 format with timezone",
|
||||
description: "Get current time in full RFC 3339 format with time zone.",
|
||||
example: r#"date now | debug"#,
|
||||
result: None,
|
||||
},
|
||||
|
@ -50,11 +50,6 @@ impl Command for SubCommand {
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "Convert the current date into a record.",
|
||||
example: "date to-record",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Convert the current date into a record.",
|
||||
example: "date now | date to-record",
|
||||
|
@ -52,11 +52,6 @@ impl Command for SubCommand {
|
||||
vec![
|
||||
Example {
|
||||
description: "Convert the current date into a table.",
|
||||
example: "date to-table",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Convert the date into a table.",
|
||||
example: "date now | date to-table",
|
||||
result: None,
|
||||
},
|
||||
|
@ -77,27 +77,27 @@ impl Command for SubCommand {
|
||||
|
||||
vec![
|
||||
Example {
|
||||
description: "Get the current date in UTC+05:00",
|
||||
description: "Get the current date in UTC+05:00.",
|
||||
example: "date now | date to-timezone '+0500'",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get the current local date",
|
||||
description: "Get the current date in the local time zone.",
|
||||
example: "date now | date to-timezone local",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get the current date in Hawaii",
|
||||
description: "Get the current date in Hawaii.",
|
||||
example: "date now | date to-timezone US/Hawaii",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get the current date in Hawaii",
|
||||
description: "Get a date in a different time zone, from a string.",
|
||||
example: r#""2020-10-10 10:00:00 +02:00" | date to-timezone "+0500""#,
|
||||
result: example_result_1(),
|
||||
},
|
||||
Example {
|
||||
description: "Get the current date in Hawaii, from a datetime object",
|
||||
description: "Get a date in a different time zone, from a datetime.",
|
||||
example: r#""2020-10-10 10:00:00 +02:00" | into datetime | date to-timezone "+0500""#,
|
||||
result: example_result_1(),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user