Skip to content
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

Allow --list (or another option) to filter listed tasks #134

Open
bitprophet opened this issue Aug 19, 2011 · 2 comments
Open

Allow --list (or another option) to filter listed tasks #134

bitprophet opened this issue Aug 19, 2011 · 2 comments

Comments

@bitprophet
Copy link
Member

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.


Originally submitted by Jeff Forcier (bitprophet) on 2010-01-12 at 01:31pm EST

@ghost ghost assigned bitprophet Aug 19, 2011
@bitprophet
Copy link
Member Author

Travis Swicegood (tswicegood) posted:


I like this, with one caveat. I'd make the optional string a regular expression.


on 2010-01-17 at 05:54pm EST

@bitprophet
Copy link
Member Author

Marcelo Ramos (marcelor) posted:


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


on 2010-04-10 at 01:08am EDT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant