Skip to content

Instantly share code, notes, and snippets.

@javier-lopez
Created November 23, 2011 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javier-lopez/1388027 to your computer and use it in GitHub Desktop.
Save javier-lopez/1388027 to your computer and use it in GitHub Desktop.
# Last review Fri 06 Aug 2010 01:02:51 PM CDT
# Debian GNU/Linux cowbuilder(1) completion
# Copyright 2007 Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>
#
# This script can be distributed under the same license as the
# cowdancer or bash packages.
#
# adapted to pbuilder, the license is GPLv2 or later.
# Copyright 2007 Junichi Uekawa <dancer@debian.org>
have pbuilder &&
_pbuilder()
{
#When the function or command is invoked, the first argument is the name of
#the command whose arguments are being completed, the second argument is the
#word being completed, and the third argument is the word preceding the word
#being completed on the current command line.
#program_name=$1
#cur=$2
#prev=$3
local cur options
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
options='--create --update --build --login --execute --dumpconfig create update build login execute'
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$options" | grep "^$cur" ) )
elif [ "${COMP_WORDS[1]}" = --build ]; then
COMPREPLY=( $( compgen -o filenames -G "$cur*.dsc" ) )
elif [ "${COMP_WORDS[1]}" = build ]; then
COMPREPLY=( $( compgen -o filenames -G "$cur*.dsc" ) )
fi
return 0
}
[ "$have" ] && complete -F _pbuilder -o filenames pbuilder pbuilder.lucid pbuilder.maverick pbuilder.natty pbuilder.oneiric pbuilder.precise pbuilder.sid pbuilder.unstable
# vim: set ts=8 sw=4 tw=0 ft=sh :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment