Feature #134
Allow --list (or another option) to filter listed tasks
| Status: | New | Start: | 01/12/2010 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | CLI | |||
| Target version: | 1.0 | |||
Description
When using large fabfiles, one may wish to search for or filter task names. E.g. you know you have some relating to Python but aren’t entirely sure and want to do something like fab --list "py*".
Benefit of adding this to -l/--list is that we don’t need to consume another flag/letter; but it then makes the helpstring for that option longer. Plus it’s a relatively common pattern (empty option defaults to “all”, option with an arg limits somehow.)
On the other hand, it would be a simpler implementation to make another dedicated CLI flag, as having “no or one” options requires a callback in optparse (AFAICT anyways.) Plus there is at least some argument for making each individual option relatively simple instead of doubling them up.
History
Updated by Travis Swicegood 193 days ago
I like this, with one caveat. I'd make the optional string a regular expression.
Updated by Marcelo Ramos 111 days ago
optparse doesn’t support “optional option arguments” so we can’t have a -l option who can a receive an optional pattern to use as a regexp. Anyway, I implemented a new option -L with a required string as argument and uses it as a regexp to filter out the list of commands. It does the job.
http://github.com/marcelor/fabric/commit/b91b41e3515ff400579f210775ea04b7d0468b81
Also available in: Atom