diff options
Diffstat (limited to 'completions/lvm')
-rw-r--r-- | completions/lvm | 412 |
1 files changed, 207 insertions, 205 deletions
diff --git a/completions/lvm b/completions/lvm index 712838c8..e70ecc3a 100644 --- a/completions/lvm +++ b/completions/lvm @@ -8,26 +8,26 @@ _lvm_filedir() _lvm_volumegroups() { - COMPREPLY=( $(compgen -W "$(vgscan 2>/dev/null | \ - command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur") ) + COMPREPLY=($(compgen -W "$(vgscan 2>/dev/null | + command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p')" -- "$cur")) } _lvm_physicalvolumes_all() { - COMPREPLY=( $(compgen -W "$(pvscan 2>/dev/null | \ - command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p' )" -- "$cur") ) + COMPREPLY=($(compgen -W "$(pvscan 2>/dev/null | + command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p')" -- "$cur")) } _lvm_physicalvolumes() { - COMPREPLY=( $(compgen -W "$(pvscan 2>/dev/null | \ - command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur") ) + COMPREPLY=($(compgen -W "$(pvscan 2>/dev/null | + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p')" -- "$cur")) } _lvm_logicalvolumes() { - COMPREPLY=( $(compgen -W "$(lvscan 2>/dev/null | \ - command sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur") ) + COMPREPLY=($(compgen -W "$(lvscan 2>/dev/null | + command sed -n -e "s|^.*'\(.*\)'.*$|\1|p")" -- "$cur")) if [[ $cur == /dev/mapper/* ]]; then _filedir local i @@ -39,12 +39,12 @@ _lvm_logicalvolumes() _lvm_units() { - COMPREPLY=( $(compgen -W 'h s b k m g t H K M G T' -- "$cur") ) + COMPREPLY=($(compgen -W 'h s b k m g t H K M G T' -- "$cur")) } _lvm_sizes() { - COMPREPLY=( $(compgen -W 'k K m M g G t T' -- "$cur") ) + COMPREPLY=($(compgen -W 'k K m M g G t T' -- "$cur")) } # @param $1 glob matching args known to take an argument @@ -52,13 +52,14 @@ _lvm_count_args() { args=0 local offset=1 - if [[ "${words[0]}" == lvm ]]; then + if [[ ${words[0]} == lvm ]]; then offset=2 fi - local i prev=${words[$offset-1]} - for (( i=$offset; i < cword; i++ )); do - if [[ "${words[i]}" != -* && $prev != $1 ]]; then - (( args++ )) + local i prev=${words[offset - 1]} + for ((i = offset; i < cword; i++)); do + # shellcheck disable=SC2053 + if [[ ${words[i]} != -* && $prev != $1 ]]; then + ((args++)) fi prev=${words[i]} done @@ -69,22 +70,22 @@ _lvmdiskscan() local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && -complete -F _lvmdiskscan lvmdiskscan + complete -F _lvmdiskscan lvmdiskscan _pvscan() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && -complete -F _pvscan pvscan + complete -F _pvscan pvscan _pvs() { @@ -92,9 +93,9 @@ _pvs() _init_completion || return case $prev in - --options|--sort|-!(-*)[oO]) - COMPREPLY=( $(compgen -W 'pv_fmt pv_uuid pv_size pv_free pv_used - pv_name pv_attr pv_pe_count pv_pe_alloc_count' -- "$cur") ) + --options | --sort | -!(-*)[oO]) + COMPREPLY=($(compgen -W 'pv_fmt pv_uuid pv_size pv_free pv_used + pv_name pv_attr pv_pe_count pv_pe_alloc_count' -- "$cur")) return ;; --units) @@ -103,13 +104,13 @@ _pvs() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && -complete -F _pvs pvs + complete -F _pvs pvs _pvdisplay() { @@ -123,13 +124,13 @@ _pvdisplay() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && -complete -F _pvdisplay pvdisplay + complete -F _pvdisplay pvdisplay _pvchange() { @@ -137,19 +138,19 @@ _pvchange() _init_completion || return case $prev in - --autobackup|--allocatable|-!(-*)[Ax]) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | --allocatable | -!(-*)[Ax]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && -complete -F _pvchange pvchange + complete -F _pvchange pvchange _pvcreate() { @@ -161,27 +162,27 @@ _pvcreate() _filedir return ;; - --metadatatype|-!(-*)M) - COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; --metadatacopies) - COMPREPLY=( $(compgen -W '0 1 2' -- "$cur") ) + COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) return ;; - --metadatasize|--setphysicalvolumesize) + --metadatasize | --setphysicalvolumesize) _lvm_sizes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_filedir fi } && -complete -F _pvcreate pvcreate + complete -F _pvcreate pvcreate _pvmove() { @@ -189,46 +190,47 @@ _pvmove() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --name|-!(-*)n) + --name | -!(-*)n) _lvm_logicalvolumes return + ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes fi } && -complete -F _pvmove pvmove + complete -F _pvmove pvmove _pvremove() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_physicalvolumes_all fi } && -complete -F _pvremove pvremove + complete -F _pvremove pvremove _vgscan() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && -complete -F _vgscan vgscan + complete -F _vgscan vgscan _vgs() { @@ -236,11 +238,11 @@ _vgs() _init_completion || return case $prev in - --options|--sort|-!(-*)[oO]) - COMPREPLY=( $(compgen -W 'vg_fmt vg_uuid vg_name vg_attr vg_size + --options | --sort | -!(-*)[oO]) + COMPREPLY=($(compgen -W 'vg_fmt vg_uuid vg_name vg_attr vg_size vg_free vg_sysid vg_extent_size vg_extent_count vg_free_count max_lv max_pv pv_count lv_count snap_count vg_seqno' \ - -- "$cur") ) + -- "$cur")) return ;; --units) @@ -249,13 +251,13 @@ _vgs() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgs vgs + complete -F _vgs vgs _vgdisplay() { @@ -269,13 +271,13 @@ _vgdisplay() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgdisplay vgdisplay + complete -F _vgdisplay vgdisplay _vgchange() { @@ -283,19 +285,19 @@ _vgchange() _init_completion || return case $prev in - --available|--autobackup|--resizeable|-!(-*)[aAx]) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --available | --autobackup | --resizeable | -!(-*)[aAx]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgchange vgchange + complete -F _vgchange vgchange _vgcreate() { @@ -303,46 +305,46 @@ _vgcreate() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --metadatatype|-!(-*)M) - COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; - --physicalextentsize|-!(-*)s) + --physicalextentsize | -!(-*)s) _lvm_sizes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' - if [[ $args -eq 0 ]]; then + if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes_all fi fi } && -complete -F _vgcreate vgcreate + complete -F _vgcreate vgcreate _vgremove() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgremove vgremove + complete -F _vgremove vgremove _vgrename() { @@ -350,19 +352,19 @@ _vgrename() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgrename vgrename + complete -F _vgrename vgrename _vgreduce() { @@ -370,26 +372,26 @@ _vgreduce() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup)' - if [[ $args -eq 0 ]]; then + if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes fi fi } && -complete -F _vgreduce vgreduce + complete -F _vgreduce vgreduce _vgextend() { @@ -397,55 +399,55 @@ _vgextend() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --size|-!(-*)L) + --size | -!(-*)L) _lvm_sizes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' - if [[ $args -eq 0 ]]; then + if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes_all fi fi } && -complete -F _vgextend vgextend + complete -F _vgextend vgextend _vgport() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgport vgimport vgexport + complete -F _vgport vgimport vgexport _vgck() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgck vgck + complete -F _vgck vgck _vgconvert() { @@ -453,12 +455,12 @@ _vgconvert() _init_completion || return case $prev in - --metadatatype|-!(-*)M) - COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; --metadatacopies) - COMPREPLY=( $(compgen -W '0 1 2' -- "$cur") ) + COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) return ;; --metadatasize) @@ -467,13 +469,13 @@ _vgconvert() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgconvert vgconvert + complete -F _vgconvert vgconvert _vgcfgbackup() { @@ -481,19 +483,19 @@ _vgcfgbackup() _init_completion || return case $prev in - --file|-!(-*)f) + --file | -!(-*)f) _filedir return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgcfgbackup vgcfgbackup + complete -F _vgcfgbackup vgcfgbackup _vgcfgrestore() { @@ -501,27 +503,27 @@ _vgcfgrestore() _init_completion || return case $prev in - --file|-!(-*)f) + --file | -!(-*)f) _filedir return ;; - --metadatatype|-!(-*)M) - COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; - --name|-!(-*)n) + --name | -!(-*)n) _lvm_volumegroups return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgcfgrestore vgcfgrestore + complete -F _vgcfgrestore vgcfgrestore _vgmerge() { @@ -529,19 +531,19 @@ _vgmerge() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgmerge vgmerge + complete -F _vgmerge vgmerge _vgsplit() { @@ -549,53 +551,53 @@ _vgsplit() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --metadatatype|-!(-*)M) - COMPREPLY=( $(compgen -W '1 2' -- "$cur") ) + --metadatatype | -!(-*)M) + COMPREPLY=($(compgen -W '1 2' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' - if [[ $args -eq 0 || $args -eq 1 ]]; then + if ((args == 0 || args == 1)); then _lvm_volumegroups else _lvm_physicalvolumes fi fi } && -complete -F _vgsplit vgsplit + complete -F _vgsplit vgsplit _vgmknodes() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_volumegroups fi } && -complete -F _vgmknodes vgmknodes + complete -F _vgmknodes vgmknodes _lvscan() { local cur prev words cword _init_completion || return - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) fi } && -complete -F _lvscan lvscan + complete -F _lvscan lvscan _lvs() { @@ -603,10 +605,10 @@ _lvs() _init_completion || return case $prev in - --options|--sort|-!(-*)[oO]) - COMPREPLY=( $(compgen -W 'lv_uuid lv_name lv_attr lv_minor lv_size + --options | --sort | -!(-*)[oO]) + COMPREPLY=($(compgen -W 'lv_uuid lv_name lv_attr lv_minor lv_size seg_count origin snap_percent segtype stripes stripesize - chunksize seg_start seg_size' -- "$cur") ) + chunksize seg_start seg_size' -- "$cur")) return ;; --units) @@ -615,13 +617,13 @@ _lvs() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && -complete -F _lvs lvs + complete -F _lvs lvs _lvdisplay() { @@ -635,13 +637,13 @@ _lvdisplay() ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && -complete -F _lvdisplay lvdisplay + complete -F _lvdisplay lvdisplay _lvchange() { @@ -649,23 +651,23 @@ _lvchange() _init_completion || return case $prev in - --available|--autobackup|--contiguous|--persistent|-!(-*)[aACM]) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --available | --autobackup | --contiguous | --persistent | -!(-*)[aACM]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --permission|-!(-*)p) - COMPREPLY=( $(compgen -W 'r rw' -- "$cur") ) + --permission | -!(-*)p) + COMPREPLY=($(compgen -W 'r rw' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && -complete -F _lvchange lvchange + complete -F _lvchange lvchange _lvcreate() { @@ -673,37 +675,37 @@ _lvcreate() _init_completion || return case $prev in - --autobackup|--contiguous|--persistent|--zero|-!(-*)[ACMZ]) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | --contiguous | --persistent | --zero | -!(-*)[ACMZ]) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --size|-!(-*)L) + --size | -!(-*)L) _lvm_sizes return ;; - --permission|-!(-*)p) - COMPREPLY=( $(compgen -W 'r rw' -- "$cur") ) + --permission | -!(-*)p) + COMPREPLY=($(compgen -W 'r rw' -- "$cur")) return ;; - --name|-!(-*)n) + --name | -!(-*)n) _lvm_logicalvolumes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)' - if [[ $args -eq 0 ]]; then + if ((args == 0)); then _lvm_volumegroups else _lvm_physicalvolumes fi fi } && -complete -F _lvcreate lvcreate + complete -F _lvcreate lvcreate _lvremove() { @@ -711,19 +713,19 @@ _lvremove() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && -complete -F _lvremove lvremove + complete -F _lvremove lvremove _lvrename() { @@ -731,19 +733,19 @@ _lvrename() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && -complete -F _lvrename lvrename + complete -F _lvrename lvrename _lvreduce() { @@ -751,23 +753,23 @@ _lvreduce() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --size|-!(-*)L) + --size | -!(-*)L) _lvm_sizes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else _lvm_logicalvolumes fi } && -complete -F _lvreduce lvreduce + complete -F _lvreduce lvreduce _lvresize() { @@ -775,29 +777,29 @@ _lvresize() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --size|-!(-*)L) + --size | -!(-*)L) _lvm_sizes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' - if [[ $args -eq 0 ]]; then + if ((args == 0)); then _lvm_logicalvolumes else _lvm_physicalvolumes fi fi } && -complete -F _lvresize lvresize + complete -F _lvresize lvresize _lvextend() { @@ -805,55 +807,55 @@ _lvextend() _init_completion || return case $prev in - --autobackup|-!(-*)A) - COMPREPLY=( $(compgen -W 'y n' -- "$cur") ) + --autobackup | -!(-*)A) + COMPREPLY=($(compgen -W 'y n' -- "$cur")) return ;; - --size|-!(-*)L) + --size | -!(-*)L) _lvm_sizes return ;; esac - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_usage "$1" --help)' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) else local args _lvm_count_args '@(-A|--autobackup|-L|--size)' - if [[ $args -eq 0 ]]; then + if ((args == 0)); then _lvm_logicalvolumes else _lvm_physicalvolumes fi fi } && -complete -F _lvextend lvextend + complete -F _lvextend lvextend _lvm() { local cur prev words cword _init_completion || return - if [[ $cword -eq 1 ]]; then - COMPREPLY=( $(compgen -W 'dumpconfig help lvchange lvcreate lvdisplay + if ((cword == 1)); then + COMPREPLY=($(compgen -W 'dumpconfig help lvchange lvcreate lvdisplay lvextend lvmchange lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvresize lvs lvscan pvchange pvcreate pvdata pvdisplay pvmove pvremove pvresize pvs pvscan vgcfgbackup vgcfgrestore vgchange vgck vgconvert vgcreate vgdisplay vgexport vgextend vgimport vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan - vgsplit version' -- "$cur") ) + vgsplit version' -- "$cur")) else case "${words[1]}" in - pvchange|pvcreate|pvdisplay|pvmove|pvremove|pvresize|pvs|pvscan|\ - vgcfgbackup|vgcfgrestore|vgchange|vgck|vgconvert|vgcreate|\ - vgdisplay|vgexport|vgextend|vgimport|vgmerge|vgmknodes|vgreduce|\ - vgremove|vgrename|vgs|vgscan|vgsplit|lvchange|lvcreate|lvdisplay|\ - lvextend|lvreduce|lvremove|lvrename|lvresize|lvscan) + pvchange | pvcreate | pvdisplay | pvmove | pvremove | pvresize | pvs | pvscan | \ + vgcfgbackup | vgcfgrestore | vgchange | vgck | vgconvert | vgcreate | \ + vgdisplay | vgexport | vgextend | vgimport | vgmerge | vgmknodes | vgreduce | \ + vgremove | vgrename | vgs | vgscan | vgsplit | lvchange | lvcreate | lvdisplay | \ + lvextend | lvreduce | lvremove | lvrename | lvresize | lvscan) _${words[1]} ;; esac fi } && -complete -F _lvm lvm + complete -F _lvm lvm # ex: filetype=sh |