Partial command name matching
I've been using npm-run-all where it is possible to say:
npm-run-all foobar:*
which executes all commands prefixed with foobar: starting with the one that is defined first in package.json and ending with the one that is define last. See an example in the current package.json of the WebdriverIO project. Specific to Runme: let's say I have the following markdown files:
fileA.md
```sh { name=task:C }
echo "foo"
```
```sh { name=task:B }
echo "bar"
```
fileB.md
```sh { name=task:A }
echo "loo"
```
Given I run runme --project . run task:* I expect to have the following printed:
foo
bar
loo
so task:C, task:B and task:A. The order is determined by position within a file (first script is executed first) and location of file (alphabetically sorted).
This has been proven for me to be super helpful and a nice mental model to define a stack/pipeline of commands.
It would be nice to eventually see this supported in Runme as well. Wdyat?
Would be cool, though there are some ambiguities:
- How do I determine if the user wants to run a single script vs. many scripts? In other words, when should the user be prompted to select from a list of scripts, and when should they all be ran? One solution here is to use the
--allflag. - Which query language do we use? Glob and regex don't really suit this purpose. The query language we choose also needs to have decent golang support.
- How do I determine if the user wants to run a single script vs. many scripts? In other words, when should the user be prompted to select from a list of scripts, and when should they all be ran? One solution here is to use the
--allflag.
If the user runs runme --project . run task:* they expect all commands to run. I am not sure if there is a usecase where they would expect only the first command to be run.
- Which query language do we use? Glob and regex don't really suit this purpose. The query language we choose also needs to have decent golang support.
I wonder if it makes sense to come up with a custom query language that fits this particular purpose, e.g.:
-
foobar:*runsfoobar:fooorfoobar:barbut notfoobar:foo:bar -
foobar:*:*runsfoobar:foo:barbut notfoobar:foonorfoobar:bar
On the other side, using glob seems to be a viable direction too since it is is so commonly known and well defined.
If the user runs runme --project . run task:* they expect all commands to run. I am not sure if there is a usecase where they would expect only the first command to be run.
Currently, if you run runme run (task), it will ask you to select from a list of all matches to "(task)". What do we do when the query task:* matches colliding results across multiple files? If the solution is "run all of them," then this is incompatible with the current implementation.
I wonder if it makes sense to come up with a custom query language that fits this particular purpose, e.g.:
Do you happen to know what happens under the hood for npm-run-all? Perhaps there's a modified version of glob in existence that would be preferable (which would for example match * for multiple results, rather than **)