From 4fd2b702eeb33d860fc8b4bcee2687625371a366 Mon Sep 17 00:00:00 2001 From: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:04:33 +0200 Subject: [PATCH] Add long options for platform and random (#10776) --- crates/nu-cli/src/commands/keybindings_list.rs | 2 +- crates/nu-command/src/platform/ansi/ansi_.rs | 4 ++-- crates/nu-command/src/platform/input/list.rs | 4 ++-- crates/nu-command/src/random/chars.rs | 2 +- crates/nu-command/src/random/dice.rs | 2 +- crates/nu-command/tests/commands/platform/ansi_.rs | 2 +- crates/nu-command/tests/commands/random/chars.rs | 2 +- crates/nu-command/tests/commands/random/dice.rs | 2 +- crates/nu-std/std/testing.nu | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/nu-cli/src/commands/keybindings_list.rs b/crates/nu-cli/src/commands/keybindings_list.rs index 0ae2286cf..391be2efa 100644 --- a/crates/nu-cli/src/commands/keybindings_list.rs +++ b/crates/nu-cli/src/commands/keybindings_list.rs @@ -36,7 +36,7 @@ impl Command for KeybindingsList { vec![ Example { description: "Get list of key modifiers", - example: "keybindings list -m", + example: "keybindings list --modifiers", result: None, }, Example { diff --git a/crates/nu-command/src/platform/ansi/ansi_.rs b/crates/nu-command/src/platform/ansi/ansi_.rs index 4063d3362..61b13847d 100644 --- a/crates/nu-command/src/platform/ansi/ansi_.rs +++ b/crates/nu-command/src/platform/ansi/ansi_.rs @@ -624,7 +624,7 @@ Operating system commands: }, Example { description: "Use escape codes, without the '\\x1b['", - example: r#"$"(ansi -e '3;93;41m')Hello(ansi reset)" # italic bright yellow on red background"#, + example: r#"$"(ansi --escape '3;93;41m')Hello(ansi reset)" # italic bright yellow on red background"#, result: Some(Value::test_string("\u{1b}[3;93;41mHello\u{1b}[0m")), }, Example { @@ -634,7 +634,7 @@ Operating system commands: bg: '#ff0000' attr: b } - $"(ansi -e $bold_blue_on_red)Hello Nu World(ansi reset)""#, + $"(ansi --escape $bold_blue_on_red)Hello Nu World(ansi reset)""#, result: Some(Value::test_string( "\u{1b}[1;48;2;255;0;0;38;2;0;0;255mHello Nu World\u{1b}[0m", )), diff --git a/crates/nu-command/src/platform/input/list.rs b/crates/nu-command/src/platform/input/list.rs index 8ca019168..f380c4d5d 100644 --- a/crates/nu-command/src/platform/input/list.rs +++ b/crates/nu-command/src/platform/input/list.rs @@ -254,12 +254,12 @@ impl Command for InputList { }, Example { description: "Return multiple values from a list", - example: r#"[Banana Kiwi Pear Peach Strawberry] | input list -m 'Add fruits to the basket'"#, + example: r#"[Banana Kiwi Pear Peach Strawberry] | input list --multi 'Add fruits to the basket'"#, result: None, }, Example { description: "Return a single record from a table with fuzzy search", - example: r#"ls | input list -f 'Select the target'"#, + example: r#"ls | input list --fuzzy 'Select the target'"#, result: None, }, ] diff --git a/crates/nu-command/src/random/chars.rs b/crates/nu-command/src/random/chars.rs index bb1a641c2..c07e7c0cb 100644 --- a/crates/nu-command/src/random/chars.rs +++ b/crates/nu-command/src/random/chars.rs @@ -54,7 +54,7 @@ impl Command for SubCommand { }, Example { description: "Generate random chars with specified length", - example: "random chars -l 20", + example: "random chars --length 20", result: None, }, ] diff --git a/crates/nu-command/src/random/dice.rs b/crates/nu-command/src/random/dice.rs index fd1603126..8ee30658a 100644 --- a/crates/nu-command/src/random/dice.rs +++ b/crates/nu-command/src/random/dice.rs @@ -60,7 +60,7 @@ impl Command for SubCommand { }, Example { description: "Roll 10 dice with 12 sides each", - example: "random dice -d 10 -s 12", + example: "random dice --dice 10 --sides 12", result: None, }, ] diff --git a/crates/nu-command/tests/commands/platform/ansi_.rs b/crates/nu-command/tests/commands/platform/ansi_.rs index 35fc0d64b..e08ae7ebf 100644 --- a/crates/nu-command/tests/commands/platform/ansi_.rs +++ b/crates/nu-command/tests/commands/platform/ansi_.rs @@ -2,7 +2,7 @@ use nu_test_support::nu; #[test] fn test_ansi_shows_error_on_escape() { - let actual = nu!(r"ansi -e \"); + let actual = nu!(r"ansi --escape \"); assert!(actual.err.contains("no need for escape characters")) } diff --git a/crates/nu-command/tests/commands/random/chars.rs b/crates/nu-command/tests/commands/random/chars.rs index 19e0d7431..b066aaa79 100644 --- a/crates/nu-command/tests/commands/random/chars.rs +++ b/crates/nu-command/tests/commands/random/chars.rs @@ -3,7 +3,7 @@ use nu_test_support::nu; #[test] fn generates_chars_of_specified_length() { let actual = nu!(r#" - random chars -l 15 | size | get chars + random chars --length 15 | size | get chars "#); let result = actual.out; diff --git a/crates/nu-command/tests/commands/random/dice.rs b/crates/nu-command/tests/commands/random/dice.rs index 205fa69c4..9cbd1d6c6 100644 --- a/crates/nu-command/tests/commands/random/dice.rs +++ b/crates/nu-command/tests/commands/random/dice.rs @@ -3,7 +3,7 @@ use nu_test_support::nu; #[test] fn rolls_4_roll() { let actual = nu!(r#" - random dice -d 4 -s 10 | length + random dice --dice 4 --sides 10 | length "#); assert_eq!(actual.out, "4"); diff --git a/crates/nu-std/std/testing.nu b/crates/nu-std/std/testing.nu index 5edd1bdf3..e39ffbcd1 100644 --- a/crates/nu-std/std/testing.nu +++ b/crates/nu-std/std/testing.nu @@ -143,8 +143,8 @@ def show-pretty-test [indent: int = 4] { def run-test [ test: record ] { - let test_file_name = (random chars -l 10) - let test_function_name = (random chars -l 10) + let test_file_name = (random chars --length 10) + let test_function_name = (random chars --length 10) let rendered_module_path = ({parent: ($test.file|path dirname), stem: $test_file_name, extension: nu}| path join) let test_function = $"