| 1 |
# Debian GNU/Linux cowbuilder(1) completion |
| 2 |
# Copyright 2007 Cyril Brulebois <[email protected]> |
| 3 |
# Copyright 2011 David Paleino <[email protected]> |
| 4 |
# Copyright 2020 Joao Eriberto Mota Filho <[email protected]> |
| 5 |
# |
| 6 |
# This script can be distributed under the same license as the |
| 7 |
# cowdancer or bash packages. |
| 8 |
|
| 9 |
_have cowbuilder && |
| 10 |
_cowbuilder() |
| 11 |
{ |
| 12 |
local initialcommand initialcommand_options cur prev words other_options distribution |
| 13 |
|
| 14 |
COMPREPLY=() |
| 15 |
_get_comp_words_by_ref cur prev words |
| 16 |
initialcommand=${words[1]} |
| 17 |
initialcommand_options='create --create update --update build --build login --login execute --execute' |
| 18 |
other_options='--dumpconfig --distribution --mirror --basepath --architecture --configfile' |
| 19 |
distribution='sid jessie stretch buster bullseye bookworm' |
| 20 |
|
| 21 |
case $prev in |
| 22 |
--distribution) |
| 23 |
COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur" ) ) |
| 24 |
return 0 |
| 25 |
;; |
| 26 |
--basepath) |
| 27 |
_filedir -d |
| 28 |
return 0 |
| 29 |
;; |
| 30 |
--configfile) |
| 31 |
_filedir |
| 32 |
return 0 |
| 33 |
;; |
| 34 |
*) |
| 35 |
;; |
| 36 |
esac |
| 37 |
|
| 38 |
case $initialcommand in |
| 39 |
--build|build) |
| 40 |
COMPREPLY=( $( compgen -W "$other_options" -- "$cur" ) |
| 41 |
$( compgen -o filenames -G "$cur*.dsc" ) ) |
| 42 |
;; |
| 43 |
--execute|execute) |
| 44 |
COMPREPLY=( $( compgen -W "$other_options" -- "$cur" ) |
| 45 |
$( compgen -o filenames -G "$cur*" ) ) |
| 46 |
;; |
| 47 |
*) |
| 48 |
COMPREPLY=( $( compgen -W "$initialcommand_options $other_options" -- "$cur" ) ) |
| 49 |
;; |
| 50 |
esac |
| 51 |
|
| 52 |
return 0 |
| 53 |
} && |
| 54 |
complete -F _cowbuilder cowbuilder |