Last change
on this file since 327 was
228,
checked in by g7moreau, 6 years ago
|
- Add link dhcp-dns-tools in package
|
File size:
1.5 KB
|
Line | |
---|
1 | # bash completion for ddt |
---|
2 | |
---|
3 | have ddt && |
---|
4 | _ddt() { |
---|
5 | local cur prev |
---|
6 | |
---|
7 | COMPREPLY=() |
---|
8 | #_get_comp_words_by_ref cur prev |
---|
9 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
10 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
11 | |
---|
12 | case $prev in |
---|
13 | -b|--bootp) |
---|
14 | local showlist=$(ddt show-pxe --no-header|awk '{print $1}') |
---|
15 | COMPREPLY=($(compgen -W "${showlist}" -- "$cur")) |
---|
16 | return 0 |
---|
17 | ;; |
---|
18 | -d|--domainset) |
---|
19 | local showlist=$(ddt show-domainset --no-header|awk '{print $1}') |
---|
20 | COMPREPLY=($(compgen -W "${showlist}" -- "$cur")) |
---|
21 | return 0 |
---|
22 | ;; |
---|
23 | -p|--pool) |
---|
24 | local showlist=$(ddt show-pool --no-header|awk '{print $1}') |
---|
25 | COMPREPLY=($(compgen -W "${showlist}" -- "$cur")) |
---|
26 | return 0 |
---|
27 | ;; |
---|
28 | -k|--kind) |
---|
29 | COMPREPLY=($(compgen -W "dhcp pool-dhcp fix-address" -- "$cur")) |
---|
30 | return 0 |
---|
31 | ;; |
---|
32 | -t|--tag) |
---|
33 | local showlist=$(ddt show-tag --no-header|awk '{print $1}') |
---|
34 | COMPREPLY=($(compgen -W "${showlist}" -- "$cur")) |
---|
35 | return 0 |
---|
36 | ;; |
---|
37 | esac |
---|
38 | |
---|
39 | if [[ "$cur" == '-*' || $COMP_CWORD -gt 1 ]] |
---|
40 | then |
---|
41 | COMPREPLY=($(compgen -W "$(ddt help|grep "^ ddt ${COMP_WORDS[1]}"|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur")) |
---|
42 | else |
---|
43 | COMPREPLY=($(compgen -W "$($(which ddt||echo /usr/local/bin/ddt) help|grep '^ ddt'|awk '{print $2}'|xargs echo -n)" -- "$cur")) |
---|
44 | fi |
---|
45 | |
---|
46 | } && complete -F _ddt ddt |
---|
47 | |
---|
48 | have dhcp-dns-tools && complete -F _ddt dhcp-dns-tools |
---|
Note: See
TracBrowser
for help on using the repository browser.