Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / tools / ceph-lazy / bash_completion.d / ceph-lazy
1 _ceph-lazy()
2 {
3   local cur prev all_opts commands
4   COMPREPLY=()
5   cur="${COMP_WORDS[COMP_CWORD]}"
6   prev="${COMP_WORDS[COMP_CWORD-1]}"
7
8   commands="host-get-osd host-get-nodes host-osd-usage host-all-usage pg-get-host pg-most-write pg-less-write pg-most-write-kb pg-less-write-kb pg-most-read pg-less-read pg-most-read-kb pg-less-read-kb pg-empty rbd-prefix rbd-count rbd-host rbd-osd rbd-size rbd-all-size osd-most-used osd-less-used osd-get-ppg osd-get-pg object-get-host"
9
10   all_opts="$commands -d -h"
11
12
13
14 # If first option is -d keep completing without -d & -h
15   if [[ ${prev} == "-d" && ${#COMP_WORDS[@]} -eq 3 ]] ; then
16     COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
17     return 0
18 # Do completion for first args
19   elif [[ ${#COMP_WORDS[@]} -eq 2 ]]; then
20     COMPREPLY=( $(compgen -W "${all_opts}" -- ${cur}) )
21     return 0
22 # Else do nothing
23   else
24     return 0
25   fi
26 }
27 complete -F _ceph-lazy ceph-lazy