bash completion

A fantastic way to save typing, I find that this is also a huge timesaver when learning new commands. I’ll freely admit that I’ve become a little dependent.

On DICE: ensure you have the latest bash-completion-*.inf package installed (most do). Then, simply add the following to your ~/.brc:

    [[ -e /etc/bash_completion ]] && . /etc/bash_completion

Once you’ve sourced the script (manually, or by restarting a shell), simply press tab at all the usual opportune moments to activate the extended completions.

I have augmented the already impressive list of completed commands with the following:

  • The alpine mailer
  • OpenAFS utils: backup, bos, fs, fstrace, kas, pts, uss, vos
  • dcd
  • lcfg-reltool
  • lpr (for LPRng; CUPS support pending.)
  • om (yes, even remotely, but you have to wait for it!)
  • rfe (to a point, it completes map names, –options and profile names (slowly))
  • rpmsubmit
  • sshconsole

It’s also pretty simple to write completion scripts… but that’s something for another time. That said, the source for this package can be found in the bashcompletion subversion repository, and fixes and contributions are of course welcome.

Update, April 2012: sources now managed as part of the DICE source repository. Look for bash-completion there.

5 thoughts on “bash completion

  1. squinney

    Thanks for adding bash completion support for lcfg-reltool, I’ve been meaning to do that myself for ages as it saves so much typing. I’ll try to remember to keep you informed when new commands or options are added.

  2. gdutton Post author

    Thanks; updates appreciated. Generally I prefer to source commands on the fly from an appropriate –help argument, but for me this incurs a very consistent 1.4 second delay. Even with caching, this is irritating for a tab-completion, especially to an impatient and compulsive tabbers such as me :)

  3. Pingback: » monitoring postgresql about:nothing

  4. gdutton Post author

    Update: the ‘qxprof’ command is now supported, using the host’s static component configuration to generate its component list (an important distinction as this allows it to complete for “virtual” components who have no code on the host).

Leave a Reply

Your email address will not be published. Required fields are marked *