blob: 6feb2c7b469f3221a94bedb3ec322cd63d2eaf28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# youri-submit completion
# $Id$
_youri-submit()
{
local cur prev config
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
--config)
_filedir
return 0
;;
--list)
COMPREPLY=( $( compgen -W 'targets steps' -- $cur ) )
return 0
;;
--help)
COMPREPLY=( $( compgen -W 'repository steps' -- $cur ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--define --clean -l --list -h --help -t \
--test -v --verbose' -- $cur ) )
# add dangereous option for main command
if [[ ${COMP_WORDS[0]} == youri-submit ]]; then
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} --config --skip-step' \
-- $cur ) )
fi
else
_count_args
case $args in
1)
_find_config
COMPREPLY=( $( compgen -W '$( youri-submit $config --list targets )' -- $cur ) )
;;
*)
_filedir
;;
esac
fi
}
complete -F _youri-submit youri-submit youri-submit-restricted youri-submit-proxy
_find_config()
{
for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == --config ]]; then
config="--config ${COMP_WORDS[i+1]}"
break
fi
done
}
|