-
Notifications
You must be signed in to change notification settings - Fork 50
/
ansible-galaxy-completion.bash
40 lines (36 loc) · 1.05 KB
/
ansible-galaxy-completion.bash
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
#!/bin/env bash
_ansible-galaxy() {
local current_word=${COMP_WORDS[COMP_CWORD]}
local previous_word=${COMP_WORDS[COMP_CWORD - 1]}
local options="init info install list remove"
case $previous_word in
init )
options="-p --init-path --offline -s --server -f --force"
;;
info )
options="-p --roles-path -s --server"
;;
install )
options="-i --ignore-errors -n --no-deps
-r --role-file -p --roles-path -s --server -f --force"
;;
list )
options="-p --roles-path"
;;
remove )
options="-p --roles-path"
;;
esac
case $previous_word in
init|info|install|list|remove)
options="${options} -h --help"
if [[ "$current_word" == -* ]]; then
COMPREPLY=( $( compgen -W "$options" -- "$current_word" ) )
fi
;;
*)
COMPREPLY=( $( compgen -W "$options" -- "$current_word" ) )
;;
esac
}
complete -o default -F _ansible-galaxy ansible-galaxy