mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
str-expand: new capability, empty collection item (#9750)
I added a new capability to `bracoxide` which is for `brace expansion` (it's almost like bash brace expressions). Anyway, this change adds this capability: `A{,B,C} | str expand`, returns: ```md - A - AB - AC ``` `A{B,,C} | str expand`, returns: ```md - AB - A - AC ``` `A{B,C,} | str expand`, returns: ```md - AB - AC - A ``` Updated examples, according to the new feature.
This commit is contained in:
@ -69,6 +69,45 @@ impl Command for SubCommand {
|
||||
},)
|
||||
},
|
||||
|
||||
Example {
|
||||
description: "Collection may include an empty item. It can be put at the start of the list.",
|
||||
example: "\"A{,B,C}\" | str expand",
|
||||
result: Some(Value::List{
|
||||
vals: vec![
|
||||
Value::test_string("A"),
|
||||
Value::test_string("AB"),
|
||||
Value::test_string("AC"),
|
||||
],
|
||||
span: Span::test_data()
|
||||
},)
|
||||
},
|
||||
|
||||
Example {
|
||||
description: "Empty item can be at the end of the collection.",
|
||||
example: "\"A{B,C,}\" | str expand",
|
||||
result: Some(Value::List{
|
||||
vals: vec![
|
||||
Value::test_string("AB"),
|
||||
Value::test_string("AC"),
|
||||
Value::test_string("A"),
|
||||
],
|
||||
span: Span::test_data()
|
||||
},)
|
||||
},
|
||||
|
||||
Example {
|
||||
description: "Empty item can be in the middle of the collection.",
|
||||
example: "\"A{B,,C}\" | str expand",
|
||||
result: Some(Value::List{
|
||||
vals: vec![
|
||||
Value::test_string("AB"),
|
||||
Value::test_string("A"),
|
||||
Value::test_string("AC"),
|
||||
],
|
||||
span: Span::test_data()
|
||||
},)
|
||||
},
|
||||
|
||||
Example {
|
||||
description: "Also, it is possible to use one inside another. Here is a real-world example, that creates files:",
|
||||
example: "\"A{B{1,3},C{2,5}}D\" | str expand",
|
||||
|
Reference in New Issue
Block a user