optcomplete
Martin Blais <[email protected]> Mon, 26 Jan 2004 02:05:16 -0500
| Newsgroups | gmane.comp.python.optik.user |
|---|---|
| Message-ID | <[email protected]> |
hi Greg
late nite hacking, taking time off to work on personal ideas.
so following up on your suggestion back in september:
http://sourceforge.net/mailarchive/forum.php?thread_id=3142018&forum_id=6064
i have implemented the automatic bash completion as a separate module
"optcomplete" which is compatible with optparse. i have decided to clean it
up and release it for trial. you can find it here:
http://furius.ca/optcomplete/
(sorry i did not write a setup.py file yet). it's a lot of fun to see
completion appear automatically, in particular, see the sample output:
http://furius.ca/optcomplete/doc/sample-output.html
i think this could be made into something much fancier and featureful if many
people adopted it.
note: i circumvented the fact that i cannot add an option-specific completer
object directly from parser.add_option() by adding the completer data member
dynamically on the option object and then checking later on for its
existence. with tighter integration between optparse and optcomplete, we
could imagine replacing this:
opt = parser.add_option('-p', '--script', action='store',
help="Option that takes python scripts args only.")
opt.completer = optcomplete.RegexCompleter('.*\.py')
by this:
opt = parser.add_option('-p', '--script', action='store',
completer = optcomplete.RegexCompleter('.*\.py'),
help="Option that takes python scripts args only.")
comments appreciated.
cheers,
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn