-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(run): match tasks to run with glob patterns #1528
Conversation
fn get_matching(&self, pat: &str) -> Result<Vec<&T>>; | ||
} | ||
|
||
impl<T> GetMatchingExt<T> for std::collections::HashMap<String, T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we go with BTreeMap? I think the output will look a little cleaner being not randomized by HashMap
IndexMap might also be a good idea but I'm not sure what order the tasks are in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that decision would really have to be made here, but I can definitely add sorting to guarantee ordering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up to you, could be in a different PR if you want. I'm not sure how many places that would need to change off the top of my head
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, played around with this a bit only to realize parallelization ends up randomizing the output ordering anyway. So I think we can defer the decision for now since ordering is only relevant for single threaded runs (which I imagine is the less likely use case).
clever solution using the glob here. I was just going to have a naive wildcard match |
ab535ae
to
3ccfc16
Compare
this could happen later, but this code should probably be updated to use glob logic as well: Line 137 in 59c7216
|
I can pick that up in a follow up. |
Summary
Closes #1271
This change make it possible to select multiple tasks to run using glob style matching.
Task topics, separated by
:
, are treated like directories in shell matching such that patterns likea:**:d
will match tasks nameda:d
,a:b:d
ora:b:c:d
.Additional Notes
globset
in as a direct dependency, but it was transitive already.tasks_with_aliases
is used in multiple places making a more local change preferable though it may make sense to move this trait or change the return type oftasks_with_aliases
in the future.