Replies: 2 comments 10 replies
-
you mean |
Beta Was this translation helpful? Give feedback.
-
I'd like to share some examples of a command I'm currently working on, which I'll refer to as 1. Basic Brace Expansionecho ("{apple,banana,cherry}" | str expand)
# Output: apple banana cherry In this example, the brace expansion pattern Another example: echo ("~/Desktop/{file1,file2,file3}.txt" | str expand)
# Output: ~/Desktop/file1.txt ~/Desktop/file2.txt ~/Desktop/file3.txt In this example, the brace expansion pattern 2. Numeric Range Expansion:echo ("{1..5}" | str expand)
# Output: 1 2 3 4 5 In this example, the brace expansion pattern {1..5} represents a numeric range from 1 to 5.
3. Combined Brace Expansion:echo ("{A{1,2},B{3,4}}" | str expand)
# Output: A1 A2 B3 B4 Here, the brace expansion pattern These examples demonstrate the various use cases of I'm excited to share that I'm currently working on the |
Beta Was this translation helpful? Give feedback.
-
I'm considering creating a command or extension command for Nushell. Currently, I'm using
str expand
in my code, but I'm unsure if it's the right choice. I believe thatglob
is more appropriate for cases where files actually exist, like git commits or editing files. For cases where files don't exist, it doesn't seem logical to include them inglob
. I would appreciate your thoughts on this. I'm working on it and planning to make a pull request.Here is the example usage of
str expand
:The parameter doesn't necessarily have to be a path; it could be anything. In general, it can take a string in the form of
{this,and,that}
or a similar format. So, instead of restricting it to file paths, it can be used in a broader sense to accommodate various types of strings. I hope this clarifies the flexibility of the parameter.Please let me know what do you think.
Beta Was this translation helpful? Give feedback.
All reactions