mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Add long options for platform and random (#10776)
This commit is contained in:
parent
030e55acbf
commit
4fd2b702ee
9 changed files with 12 additions and 12 deletions
|
@ -36,7 +36,7 @@ impl Command for KeybindingsList {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "Get list of key modifiers",
|
description: "Get list of key modifiers",
|
||||||
example: "keybindings list -m",
|
example: "keybindings list --modifiers",
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
|
|
|
@ -624,7 +624,7 @@ Operating system commands:
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Use escape codes, without the '\\x1b['",
|
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")),
|
result: Some(Value::test_string("\u{1b}[3;93;41mHello\u{1b}[0m")),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
|
@ -634,7 +634,7 @@ Operating system commands:
|
||||||
bg: '#ff0000'
|
bg: '#ff0000'
|
||||||
attr: b
|
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(
|
result: Some(Value::test_string(
|
||||||
"\u{1b}[1;48;2;255;0;0;38;2;0;0;255mHello Nu World\u{1b}[0m",
|
"\u{1b}[1;48;2;255;0;0;38;2;0;0;255mHello Nu World\u{1b}[0m",
|
||||||
)),
|
)),
|
||||||
|
|
|
@ -254,12 +254,12 @@ impl Command for InputList {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Return multiple values from a list",
|
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,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Return a single record from a table with fuzzy search",
|
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,
|
result: None,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl Command for SubCommand {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Generate random chars with specified length",
|
description: "Generate random chars with specified length",
|
||||||
example: "random chars -l 20",
|
example: "random chars --length 20",
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl Command for SubCommand {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Roll 10 dice with 12 sides each",
|
description: "Roll 10 dice with 12 sides each",
|
||||||
example: "random dice -d 10 -s 12",
|
example: "random dice --dice 10 --sides 12",
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,7 +2,7 @@ use nu_test_support::nu;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ansi_shows_error_on_escape() {
|
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"))
|
assert!(actual.err.contains("no need for escape characters"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ use nu_test_support::nu;
|
||||||
#[test]
|
#[test]
|
||||||
fn generates_chars_of_specified_length() {
|
fn generates_chars_of_specified_length() {
|
||||||
let actual = nu!(r#"
|
let actual = nu!(r#"
|
||||||
random chars -l 15 | size | get chars
|
random chars --length 15 | size | get chars
|
||||||
"#);
|
"#);
|
||||||
|
|
||||||
let result = actual.out;
|
let result = actual.out;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use nu_test_support::nu;
|
||||||
#[test]
|
#[test]
|
||||||
fn rolls_4_roll() {
|
fn rolls_4_roll() {
|
||||||
let actual = nu!(r#"
|
let actual = nu!(r#"
|
||||||
random dice -d 4 -s 10 | length
|
random dice --dice 4 --sides 10 | length
|
||||||
"#);
|
"#);
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
|
|
|
@ -143,8 +143,8 @@ def show-pretty-test [indent: int = 4] {
|
||||||
def run-test [
|
def run-test [
|
||||||
test: record
|
test: record
|
||||||
] {
|
] {
|
||||||
let test_file_name = (random chars -l 10)
|
let test_file_name = (random chars --length 10)
|
||||||
let test_function_name = (random chars -l 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 rendered_module_path = ({parent: ($test.file|path dirname), stem: $test_file_name, extension: nu}| path join)
|
||||||
|
|
||||||
let test_function = $"
|
let test_function = $"
|
||||||
|
|
Loading…
Reference in a new issue