forked from dysosmus/ansible-completion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ansible-playbook-completion.bash
25 lines (22 loc) · 1.14 KB
/
ansible-playbook-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
#!/bin/env bash
_ansible-playbook() {
local current_word=${COMP_WORDS[COMP_CWORD]}
local previous_word=${COMP_WORDS[COMP_CWORD - 1]}
local options="--ask-become-pass -k --ask-pass --ask-su-pass
-K --ask-sudo-pass --ask-vault-pass -b --become
--become-method --become-user -C --check -c
--connection -D --diff -e --extra-vars --flush-cache
--force-handlers -f --forks -h --help -i
--inventory-file -l --limit --list-hosts
--list-tags --list-tasks -M --module-path
--private-key --skip-tags --start-at-task
--step -S --su -R --su-user -s --sudo -U --sudo-user
--syntax-check -t --tags -T --timeout -u --user
--vault-password-file -v --verbose --version"
if [[ "$current_word" == -* ]]; then
COMPREPLY=( $( compgen -W "$options" -- "$current_word" ) )
elif [[ "$previous_word" == "-l" ]] || [[ "$previous_word" == "--limit" ]]; then
_ansible_complete_host "$current_word"
fi
}
complete -o default -F _ansible-playbook ansible-playbook