mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
Shell: Allow parts of globs to be named in match expressions
This patchset allows a match expression to have a list of names for its glob parts, which are assigned to the matched values in the body of the match. For example, ```sh stuff=foobarblahblah/target_{1..30} for $stuff { match $it { */* as (dir sub) { echo "doing things with $sub in $dir" make -C $dir $sub # or whatever... } } } ``` With this, match expressions are now significantly more powerful!
This commit is contained in:
parent
0801b1fada
commit
1a4ac3531f
6 changed files with 115 additions and 10 deletions
|
@ -912,6 +912,8 @@ private:
|
|||
|
||||
struct MatchEntry {
|
||||
NonnullRefPtrVector<Node> options;
|
||||
Optional<Vector<String>> match_names;
|
||||
Optional<Position> match_as_position;
|
||||
Vector<Position> pipe_positions;
|
||||
RefPtr<Node> body;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue