mingus:~ 03:16:45 $ wget --c[TAB] --ca-certificate=file --certificate=file --convert-links --ca-directory=directory --connect-timeout=seconds --cut-dirs=number --certificate-type=type --continueTheoretically you could take this a step further and complete the values of the options as well. Many of the options say "--foo=file", "--foo file", "--bar host", etc.. You could parse out this "file" or "host" keyword and switch the completion style accordingly. If you 'apt-get install bash-completion' you'll get a ton of completion functions which specialize in host, file, and directory completion. Shouldn't be too hard to wire them in. If anyone gets the urge to do it, definitely share your results. The above code is stored in gist.github.com, so fork away!
Tuesday, March 2, 2010
Man-page based Bash Completion
Hacked up this little function which you can use to get generic bash completion on any command based on the man page. You just need to source this file. Here's what it looks like when executed