Nov
06
2009

tab-completion for portage tools

Step 1: Set bash-completion USE flag

grep -q 'USE\([:space:]\)*=.*bash-completion' /etc/make.conf || sed --in-place -e 's/USE\([:space:]\)*="/USE="bash-completion /g' /etc/make.conf

Step 2a: updating world
If you had to add the use flag, you will now want to update world to ensure all necessary packages are using it.
emerge -uN world

Step 2b: emerging needed ebuilds
emerge -av bash-completion gentoo-bashcomp
This will emerge the packages you need bash-completion (programmable completion for BASH) and gentoo-bashcomp (gentoo-based BASH CLI completions)

Step 3: editing the bashrc
since most portage tools are primarily for root we’ll add the bash completion line (bash-completion recommends adding this to ~/.bashrc normally) on a more global scale by placing it in /etc/bash/bashrc
echo "[[ -f /etc/profile.d/bash-completion ]] && source /etc/profile.d/bash-completion" >>/etc/bash/bashrc
source /etc/bash/bashrc

All Done!

basic usage would look like so:
emerge ne
emerge net-

etc…

Bookmark and Share
Written by david.durost in: Gentoo, Linux, howtos |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click on the image to regenerate some new text.

Anti-Spam Image

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes