Add long options for platform and random (#10776)

This commit is contained in:
Hofer-Julian 2023-10-19 22:04:33 +02:00 committed by GitHub
parent 030e55acbf
commit 4fd2b702ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 12 deletions

View File

@ -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 {

View File

@ -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",
)),

View File

@ -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,
},
]

View File

@ -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,
},
]

View File

@ -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,
},
]

View File

@ -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"))
}

View File

@ -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;

View File

@ -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");

View File

@ -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 = $"