shell completion support for optparse/optik
Martin Blais <[email protected]> Tue, 16 Sep 2003 11:10:59 -0400
| Newsgroups | gmane.comp.python.optik.user |
|---|---|
| Organization | Furius |
| Message-ID | <[email protected]> |
hi greg
i've just had an idea, not sure if it's already been discussed for your optik
package, just wondering what you think:
i was thinking that given that the parser has a pretty complete description of
the input parameters, it would probably be possible to write a single bash
function for all optparse-using programs, to perform completion by invoking
the program with a particular option, something like "--perform-complete";
the option parser, given it has seen that option, instead of returning, would
return the completion string to the shell. this way all the programs that
use optparse would get shell completion support automatically! wouldn't that
rock?
also, to deal with the arguments, we could give it some object/method to deal
with completion for the arguments, say something like this::
parser = optparse.OptionParser(\
complete=optparse.GlobCompletion(['*.tar.gz', '*.tar.bz2'])
one could create other completion methods as well.
any thoughts? do you think this is implementable?
any ideas?
cheers,
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf