Skip to content

Instantly share code, notes, and snippets.

@Stebalien
Created May 23, 2013 04:38
Show Gist options
  • Save Stebalien/5632764 to your computer and use it in GitHub Desktop.
Save Stebalien/5632764 to your computer and use it in GitHub Desktop.
Aptitude bash completions
# Install Completion
#
_aptitude_all()
{
local cur dashoptions
COMPREPLY=()
cur=`_get_cword`
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \
--with-recommends --with-suggests -R -G \
--without-recommends --without-suggests -t \
--target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused'
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
else
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
fi
return 0
}
_aptitude_installed()
{
local cur dashoptions
COMPREPLY=()
cur=`_get_cword`
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \
--with-recommends --with-suggests -R -G \
--without-recommends --without-suggests -t \
--target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused'
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
else
COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
fi
return 0
}
complete -F _aptitude_all $default inst
complete -F _aptitude_all $default upgrade
complete -F _aptitude_all $default apt-info
complete -F _aptitude_all $default apt-changes
complete -F _aptitude_all $default apt-download
complete -F _aptitude_installed $default uninst
complete -F _aptitude_installed $default reinst
complete -F _aptitude_installed $default purge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment