about:nothing

not-a-blog, not-a-service, not-a-clue.

bash completion

with 5 comments

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.

Written by gdutton

14 January 2009 at 0734

5 Responses

Subscribe to comments with RSS.

  1. 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.

    squinney

    15 January 2009 at 1033

  2. 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 :)

    gdutton

    15 January 2009 at 1502

  3. [...] I mention that I recently added bash tab-completion to the lcfg-reltool command?) Review the output and make any mandatory changes to the component to [...]

  4. 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).

    gdutton

    16 July 2009 at 2048

  5. Updated to note new location in DICE source repository.

    gdutton

    26 April 2012 at 1129


Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>