| 1 |
# Debian GNU/Linux cowbuilder(1) completion |
| 2 |
# Copyright 2007 Cyril Brulebois <[email protected]> |
| 3 |
# Copyright 2009 Junichi Uekawa |
| 4 |
# |
| 5 |
# This script can be distributed under the same license as the |
| 6 |
# cowdancer or bash packages. |
| 7 |
|
| 8 |
_have qemubuilder && |
| 9 |
_qemubuilder() |
| 10 |
{ |
| 11 |
local initialcommand initialcommand_options cur prev other_options distribution |
| 12 |
|
| 13 |
COMPREPLY=() |
| 14 |
cur=$(_get_cword) |
| 15 |
prev=${COMP_WORDS[COMP_CWORD-1]} |
| 16 |
initialcommand=${COMP_WORDS[1]} |
| 17 |
initialcommand_options='--create --update --build --login --execute' |
| 18 |
other_options='--dumpconfig --distribution --mirror --basepath --architecture' |
| 19 |
distribution='sid sarge etch woody lenny squeeze' |
| 20 |
|
| 21 |
case $initialcommand in |
| 22 |
--build) |
| 23 |
COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) |
| 24 |
$( compgen -o filenames -G "$cur*.dsc" ) ) |
| 25 |
;; |
| 26 |
--execute) |
| 27 |
COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) |
| 28 |
$( compgen -o filenames -G "$cur*" ) ) |
| 29 |
;; |
| 30 |
*) |
| 31 |
COMPREPLY=( $( compgen -W "$initialcommand_options" | grep "^$cur" ) |
| 32 |
$( compgen -W "$other_options" | grep "^$cur" ) |
| 33 |
) |
| 34 |
;; |
| 35 |
esac |
| 36 |
|
| 37 |
case $prev in |
| 38 |
--distribution) |
| 39 |
COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur" ) ) |
| 40 |
;; |
| 41 |
*) |
| 42 |
esac |
| 43 |
|
| 44 |
return 0 |
| 45 |
} |
| 46 |
complete -F _qemubuilder -o filenames qemubuilder |