From 765b303689c083db4d0bc9157cc40df7815d76f6 Mon Sep 17 00:00:00 2001 From: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com> Date: Sun, 8 Oct 2023 19:07:09 +0200 Subject: [PATCH] Add long options for formats (#10645) --- crates/nu-command/src/formats/from/ods.rs | 2 +- crates/nu-command/src/formats/from/ssv.rs | 2 +- crates/nu-command/src/formats/from/tsv.rs | 2 +- crates/nu-command/src/formats/from/xlsx.rs | 2 +- crates/nu-command/src/formats/to/csv.rs | 2 +- crates/nu-command/src/formats/to/json.rs | 2 +- crates/nu-command/src/formats/to/xml.rs | 2 +- crates/nu-command/tests/format_conversions/ods.rs | 2 +- crates/nu-command/tests/format_conversions/xlsx.rs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/nu-command/src/formats/from/ods.rs b/crates/nu-command/src/formats/from/ods.rs index 23f66d6f5..5850733e7 100644 --- a/crates/nu-command/src/formats/from/ods.rs +++ b/crates/nu-command/src/formats/from/ods.rs @@ -62,7 +62,7 @@ impl Command for FromOds { }, Example { description: "Convert binary .ods data to a table, specifying the tables", - example: "open --raw test.ods | from ods -s [Spreadsheet1]", + example: "open --raw test.ods | from ods --sheets [Spreadsheet1]", result: None, }, ] diff --git a/crates/nu-command/src/formats/from/ssv.rs b/crates/nu-command/src/formats/from/ssv.rs index cfd184551..44249dba7 100644 --- a/crates/nu-command/src/formats/from/ssv.rs +++ b/crates/nu-command/src/formats/from/ssv.rs @@ -53,7 +53,7 @@ impl Command for FromSsv { )), }, Example { example: r#"'FOO BAR -1 2' | from ssv -n"#, +1 2' | from ssv --noheaders"#, description: "Converts ssv formatted string to table but not treating the first row as column names", result: Some( Value::list( diff --git a/crates/nu-command/src/formats/from/tsv.rs b/crates/nu-command/src/formats/from/tsv.rs index 637c1224b..ed6cd353e 100644 --- a/crates/nu-command/src/formats/from/tsv.rs +++ b/crates/nu-command/src/formats/from/tsv.rs @@ -93,7 +93,7 @@ impl Command for FromTsv { }, Example { description: "Create a tsv file without header columns and open it", - example: r#"$'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2' | save tsv-data | open tsv-data | from tsv -n"#, + example: r#"$'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2' | save tsv-data | open tsv-data | from tsv --noheaders"#, result: None, }, Example { diff --git a/crates/nu-command/src/formats/from/xlsx.rs b/crates/nu-command/src/formats/from/xlsx.rs index 2cec14a4f..4a5057ea0 100644 --- a/crates/nu-command/src/formats/from/xlsx.rs +++ b/crates/nu-command/src/formats/from/xlsx.rs @@ -62,7 +62,7 @@ impl Command for FromXlsx { }, Example { description: "Convert binary .xlsx data to a table, specifying the tables", - example: "open --raw test.xlsx | from xlsx -s [Spreadsheet1]", + example: "open --raw test.xlsx | from xlsx --sheets [Spreadsheet1]", result: None, }, ] diff --git a/crates/nu-command/src/formats/to/csv.rs b/crates/nu-command/src/formats/to/csv.rs index 49c68c481..05da969de 100644 --- a/crates/nu-command/src/formats/to/csv.rs +++ b/crates/nu-command/src/formats/to/csv.rs @@ -44,7 +44,7 @@ impl Command for ToCsv { }, Example { description: "Outputs an CSV string representing the contents of this table", - example: "[[foo bar]; [1 2]] | to csv -s ';' ", + example: "[[foo bar]; [1 2]] | to csv --separator ';' ", result: Some(Value::test_string("foo;bar\n1;2\n")), }, Example { diff --git a/crates/nu-command/src/formats/to/json.rs b/crates/nu-command/src/formats/to/json.rs index e7f748aa1..11d617836 100644 --- a/crates/nu-command/src/formats/to/json.rs +++ b/crates/nu-command/src/formats/to/json.rs @@ -91,7 +91,7 @@ impl Command for ToJson { Example { description: "Outputs a JSON string, with 4-space indentation, representing the contents of this table", - example: "[Joe Bob Sam] | to json -i 4", + example: "[Joe Bob Sam] | to json --indent 4", result: Some(Value::test_string("[\n \"Joe\",\n \"Bob\",\n \"Sam\"\n]")), }, Example { diff --git a/crates/nu-command/src/formats/to/xml.rs b/crates/nu-command/src/formats/to/xml.rs index 11a4ce65e..7a2179bfd 100644 --- a/crates/nu-command/src/formats/to/xml.rs +++ b/crates/nu-command/src/formats/to/xml.rs @@ -60,7 +60,7 @@ Additionally any field which is: empty record, empty list or null, can be omitte }, Example { description: "Optionally, formats the text with a custom indentation setting", - example: r#"{tag: note content : [{tag: remember content : [Event]}]} | to xml -p 3"#, + example: r#"{tag: note content : [{tag: remember content : [Event]}]} | to xml --pretty 3"#, result: Some(Value::test_string( "\n Event\n", )), diff --git a/crates/nu-command/tests/format_conversions/ods.rs b/crates/nu-command/tests/format_conversions/ods.rs index c02ce9f38..34e3e5208 100644 --- a/crates/nu-command/tests/format_conversions/ods.rs +++ b/crates/nu-command/tests/format_conversions/ods.rs @@ -21,7 +21,7 @@ fn from_ods_file_to_table_select_sheet() { cwd: "tests/fixtures/formats", pipeline( r#" open sample_data.ods --raw - | from ods -s ["SalesOrders"] + | from ods --sheets ["SalesOrders"] | columns | get 0 "# diff --git a/crates/nu-command/tests/format_conversions/xlsx.rs b/crates/nu-command/tests/format_conversions/xlsx.rs index e6765d58a..fdd7dca87 100644 --- a/crates/nu-command/tests/format_conversions/xlsx.rs +++ b/crates/nu-command/tests/format_conversions/xlsx.rs @@ -21,7 +21,7 @@ fn from_excel_file_to_table_select_sheet() { cwd: "tests/fixtures/formats", pipeline( r#" open sample_data.xlsx --raw - | from xlsx -s ["SalesOrders"] + | from xlsx --sheets ["SalesOrders"] | columns | get 0 "#