diff options
Diffstat (limited to 'completions/lvm')
-rw-r--r-- | completions/lvm | 754 |
1 files changed, 399 insertions, 355 deletions
diff --git a/completions/lvm b/completions/lvm index e70ecc3..70581a7 100644 --- a/completions/lvm +++ b/completions/lvm @@ -1,56 +1,55 @@ # bash completion for lvm -*- shell-script -*- -_lvm_filedir() +_comp_cmd_lvm__filedir() { - cur=${cur:-/dev/} - _filedir + _comp_compgen -c "${cur:-/dev/}" filedir } -_lvm_volumegroups() +_comp_cmd_lvm__volumegroups() { - COMPREPLY=($(compgen -W "$(vgscan 2>/dev/null | - command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p')" -- "$cur")) + _comp_compgen_split -- "$(vgscan 2>/dev/null | + command sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p')" } -_lvm_physicalvolumes_all() +_comp_cmd_lvm__physicalvolumes_all() { - COMPREPLY=($(compgen -W "$(pvscan 2>/dev/null | - command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p')" -- "$cur")) + _comp_compgen_split -- "$(pvscan 2>/dev/null | + command sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p')" } -_lvm_physicalvolumes() +_comp_cmd_lvm__physicalvolumes() { - COMPREPLY=($(compgen -W "$(pvscan 2>/dev/null | - command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p')" -- "$cur")) + _comp_compgen_split -- "$(pvscan 2>/dev/null | + command sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p')" } -_lvm_logicalvolumes() +_comp_cmd_lvm__logicalvolumes() { - COMPREPLY=($(compgen -W "$(lvscan 2>/dev/null | - command sed -n -e "s|^.*'\(.*\)'.*$|\1|p")" -- "$cur")) + _comp_compgen_split -- "$(lvscan 2>/dev/null | + command sed -n -e "s|^.*'\(.*\)'.*$|\1|p")" if [[ $cur == /dev/mapper/* ]]; then - _filedir + _comp_compgen -a filedir local i for i in "${!COMPREPLY[@]}"; do - [[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]' + [[ ${COMPREPLY[i]} == */control ]] && unset -v 'COMPREPLY[i]' done fi } -_lvm_units() +_comp_cmd_lvm__units() { - COMPREPLY=($(compgen -W 'h s b k m g t H K M G T' -- "$cur")) + _comp_compgen -- -W 'h s b k m g t H K M G T' } -_lvm_sizes() +_comp_cmd_lvm__sizes() { - COMPREPLY=($(compgen -W 'k K m M g G t T' -- "$cur")) + _comp_compgen -- -W 'k K m M g G t T' } # @param $1 glob matching args known to take an argument -_lvm_count_args() +_comp_cmd_lvm__count_args() { - args=0 + REPLY=0 local offset=1 if [[ ${words[0]} == lvm ]]; then offset=2 @@ -59,791 +58,836 @@ _lvm_count_args() for ((i = offset; i < cword; i++)); do # shellcheck disable=SC2053 if [[ ${words[i]} != -* && $prev != $1 ]]; then - ((args++)) + ((REPLY++)) fi prev=${words[i]} done } -_lvmdiskscan() +_comp_cmd_lvmdiskscan() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help fi } && - complete -F _lvmdiskscan lvmdiskscan + complete -F _comp_cmd_lvmdiskscan lvmdiskscan -_pvscan() +_comp_cmd_pvscan() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help fi } && - complete -F _pvscan pvscan + complete -F _comp_cmd_pvscan pvscan -_pvs() +_comp_cmd_pvs() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[oO]*)' + # shellcheck disable=SC2254 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 | -${noargopts}[oO]) + _comp_compgen -- -W 'pv_fmt pv_uuid pv_size pv_free pv_used pv_name + pv_attr pv_pe_count pv_pe_alloc_count' return ;; --units) - _lvm_units + _comp_cmd_lvm__units return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_physicalvolumes_all + _comp_cmd_lvm__physicalvolumes_all fi } && - complete -F _pvs pvs + complete -F _comp_cmd_pvs pvs -_pvdisplay() +_comp_cmd_pvdisplay() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in --units) - _lvm_units + _comp_cmd_lvm__units return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_physicalvolumes_all + _comp_cmd_lvm__physicalvolumes_all fi } && - complete -F _pvdisplay pvdisplay + complete -F _comp_cmd_pvdisplay pvdisplay -_pvchange() +_comp_cmd_pvchange() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[Ax]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | --allocatable | -!(-*)[Ax]) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | --allocatable | -${noargopts}[Ax]) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_physicalvolumes_all + _comp_cmd_lvm__physicalvolumes_all fi } && - complete -F _pvchange pvchange + complete -F _comp_cmd_pvchange pvchange -_pvcreate() +_comp_cmd_pvcreate() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[M]*)' + # shellcheck disable=SC2254 case $prev in --restorefile) - _filedir + _comp_compgen_filedir return ;; - --metadatatype | -!(-*)M) - COMPREPLY=($(compgen -W '1 2' -- "$cur")) + --metadatatype | -${noargopts}M) + _comp_compgen -- -W '1 2' return ;; --metadatacopies) - COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) + _comp_compgen -- -W '0 1 2' return ;; --metadatasize | --setphysicalvolumesize) - _lvm_sizes + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_filedir + _comp_cmd_lvm__filedir fi } && - complete -F _pvcreate pvcreate + complete -F _comp_cmd_pvcreate pvcreate -_pvmove() +_comp_cmd_pvmove() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[An]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --name | -!(-*)n) - _lvm_logicalvolumes + --name | -${noargopts}n) + _comp_cmd_lvm__logicalvolumes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_physicalvolumes + _comp_cmd_lvm__physicalvolumes fi } && - complete -F _pvmove pvmove + complete -F _comp_cmd_pvmove pvmove -_pvremove() +_comp_cmd_pvremove() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_physicalvolumes_all + _comp_cmd_lvm__physicalvolumes_all fi } && - complete -F _pvremove pvremove + complete -F _comp_cmd_pvremove pvremove -_vgscan() +_comp_cmd_vgscan() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help fi } && - complete -F _vgscan vgscan + complete -F _comp_cmd_vgscan vgscan -_vgs() +_comp_cmd_vgs() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[oO]*)' + # shellcheck disable=SC2254 case $prev in - --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")) + --options | --sort | -${noargopts}[oO]) + _comp_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' return ;; --units) - _lvm_units + _comp_cmd_lvm__units return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgs vgs + complete -F _comp_cmd_vgs vgs -_vgdisplay() +_comp_cmd_vgdisplay() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in --units) - _lvm_units + _comp_cmd_lvm__units return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgdisplay vgdisplay + complete -F _comp_cmd_vgdisplay vgdisplay -_vgchange() +_comp_cmd_vgchange() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[aAx]*)' + # shellcheck disable=SC2254 case $prev in - --available | --autobackup | --resizeable | -!(-*)[aAx]) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --available | --autobackup | --resizeable | -${noargopts}[aAx]) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgchange vgchange + complete -F _comp_cmd_vgchange vgchange -_vgcreate() +_comp_cmd_vgcreate() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[AMs]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --metadatatype | -!(-*)M) - COMPREPLY=($(compgen -W '1 2' -- "$cur")) + --metadatatype | -${noargopts}M) + _comp_compgen -- -W '1 2' return ;; - --physicalextentsize | -!(-*)s) - _lvm_sizes + --physicalextentsize | -${noargopts}s) + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' - if ((args == 0)); then - _lvm_volumegroups + local REPLY + _comp_cmd_lvm__count_args '@(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)' + if ((REPLY == 0)); then + _comp_cmd_lvm__volumegroups else - _lvm_physicalvolumes_all + _comp_cmd_lvm__physicalvolumes_all fi fi } && - complete -F _vgcreate vgcreate + complete -F _comp_cmd_vgcreate vgcreate -_vgremove() +_comp_cmd_vgremove() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgremove vgremove + complete -F _comp_cmd_vgremove vgremove -_vgrename() +_comp_cmd_vgrename() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[A]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgrename vgrename + complete -F _comp_cmd_vgrename vgrename -_vgreduce() +_comp_cmd_vgreduce() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[A]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|--autobackup)' - if ((args == 0)); then - _lvm_volumegroups + local REPLY + _comp_cmd_lvm__count_args '@(-A|--autobackup)' + if ((REPLY == 0)); then + _comp_cmd_lvm__volumegroups else - _lvm_physicalvolumes + _comp_cmd_lvm__physicalvolumes fi fi } && - complete -F _vgreduce vgreduce + complete -F _comp_cmd_vgreduce vgreduce -_vgextend() +_comp_cmd_vgextend() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[AL]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --size | -!(-*)L) - _lvm_sizes + --size | -${noargopts}L) + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|--autobackup|-L|--size)' - if ((args == 0)); then - _lvm_volumegroups + local REPLY + _comp_cmd_lvm__count_args '@(-A|--autobackup|-L|--size)' + if ((REPLY == 0)); then + _comp_cmd_lvm__volumegroups else - _lvm_physicalvolumes_all + _comp_cmd_lvm__physicalvolumes_all fi fi } && - complete -F _vgextend vgextend + complete -F _comp_cmd_vgextend vgextend -_vgport() +_comp_cmd_vgport() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgport vgimport vgexport + complete -F _comp_cmd_vgport vgimport vgexport -_vgck() +_comp_cmd_vgck() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgck vgck + complete -F _comp_cmd_vgck vgck -_vgconvert() +_comp_cmd_vgconvert() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[M]*)' + # shellcheck disable=SC2254 case $prev in - --metadatatype | -!(-*)M) - COMPREPLY=($(compgen -W '1 2' -- "$cur")) + --metadatatype | -${noargopts}M) + _comp_compgen -- -W '1 2' return ;; --metadatacopies) - COMPREPLY=($(compgen -W '0 1 2' -- "$cur")) + _comp_compgen -- -W '0 1 2' return ;; --metadatasize) - _lvm_sizes + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgconvert vgconvert + complete -F _comp_cmd_vgconvert vgconvert -_vgcfgbackup() +_comp_cmd_vgcfgbackup() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[f]*)' + # shellcheck disable=SC2254 case $prev in - --file | -!(-*)f) - _filedir + --file | -${noargopts}f) + _comp_compgen_filedir return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgcfgbackup vgcfgbackup + complete -F _comp_cmd_vgcfgbackup vgcfgbackup -_vgcfgrestore() +_comp_cmd_vgcfgrestore() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[fMn]*)' + # shellcheck disable=SC2254 case $prev in - --file | -!(-*)f) - _filedir + --file | -${noargopts}f) + _comp_compgen_filedir return ;; - --metadatatype | -!(-*)M) - COMPREPLY=($(compgen -W '1 2' -- "$cur")) + --metadatatype | -${noargopts}M) + _comp_compgen -- -W '1 2' return ;; - --name | -!(-*)n) - _lvm_volumegroups + --name | -${noargopts}n) + _comp_cmd_lvm__volumegroups return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgcfgrestore vgcfgrestore + complete -F _comp_cmd_vgcfgrestore vgcfgrestore -_vgmerge() +_comp_cmd_vgmerge() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[A]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgmerge vgmerge + complete -F _comp_cmd_vgmerge vgmerge -_vgsplit() +_comp_cmd_vgsplit() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[AM]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --metadatatype | -!(-*)M) - COMPREPLY=($(compgen -W '1 2' -- "$cur")) + --metadatatype | -${noargopts}M) + _comp_compgen -- -W '1 2' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|--autobackup|-M|--metadatatype)' - if ((args == 0 || args == 1)); then - _lvm_volumegroups + local REPLY + _comp_cmd_lvm__count_args '@(-A|--autobackup|-M|--metadatatype)' + if ((REPLY < 2)); then + _comp_cmd_lvm__volumegroups else - _lvm_physicalvolumes + _comp_cmd_lvm__physicalvolumes fi fi } && - complete -F _vgsplit vgsplit + complete -F _comp_cmd_vgsplit vgsplit -_vgmknodes() +_comp_cmd_vgmknodes() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_volumegroups + _comp_cmd_lvm__volumegroups fi } && - complete -F _vgmknodes vgmknodes + complete -F _comp_cmd_vgmknodes vgmknodes -_lvscan() +_comp_cmd_lvscan() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help fi } && - complete -F _lvscan lvscan + complete -F _comp_cmd_lvscan lvscan -_lvs() +_comp_cmd_lvs() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[oO]*)' + # shellcheck disable=SC2254 case $prev in - --options | --sort | -!(-*)[oO]) - COMPREPLY=($(compgen -W 'lv_uuid lv_name lv_attr lv_minor lv_size + --options | --sort | -${noargopts}[oO]) + _comp_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' return ;; --units) - _lvm_units + _comp_cmd_lvm__units return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_logicalvolumes + _comp_cmd_lvm__logicalvolumes fi } && - complete -F _lvs lvs + complete -F _comp_cmd_lvs lvs -_lvdisplay() +_comp_cmd_lvdisplay() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in --units) - _lvm_units + _comp_cmd_lvm__units return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_logicalvolumes + _comp_cmd_lvm__logicalvolumes fi } && - complete -F _lvdisplay lvdisplay + complete -F _comp_cmd_lvdisplay lvdisplay -_lvchange() +_comp_cmd_lvchange() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[aACMp]*)' + # shellcheck disable=SC2254 case $prev in - --available | --autobackup | --contiguous | --persistent | -!(-*)[aACM]) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --available | --autobackup | --contiguous | --persistent | -${noargopts}[aACM]) + _comp_compgen -- -W 'y n' return ;; - --permission | -!(-*)p) - COMPREPLY=($(compgen -W 'r rw' -- "$cur")) + --permission | -${noargopts}p) + _comp_compgen -- -W 'r rw' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_logicalvolumes + _comp_cmd_lvm__logicalvolumes fi } && - complete -F _lvchange lvchange + complete -F _comp_cmd_lvchange lvchange -_lvcreate() +_comp_cmd_lvcreate() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[ACMZLpn]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | --contiguous | --persistent | --zero | -!(-*)[ACMZ]) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | --contiguous | --persistent | --zero | -${noargopts}[ACMZ]) + _comp_compgen -- -W 'y n' return ;; - --size | -!(-*)L) - _lvm_sizes + --size | -${noargopts}L) + _comp_cmd_lvm__sizes return ;; - --permission | -!(-*)p) - COMPREPLY=($(compgen -W 'r rw' -- "$cur")) + --permission | -${noargopts}p) + _comp_compgen -- -W 'r rw' return ;; - --name | -!(-*)n) - _lvm_logicalvolumes + --name | -${noargopts}n) + _comp_cmd_lvm__logicalvolumes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)' - if ((args == 0)); then - _lvm_volumegroups + local REPLY + _comp_cmd_lvm__count_args '@(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)' + if ((REPLY == 0)); then + _comp_cmd_lvm__volumegroups else - _lvm_physicalvolumes + _comp_cmd_lvm__physicalvolumes fi fi } && - complete -F _lvcreate lvcreate + complete -F _comp_cmd_lvcreate lvcreate -_lvremove() +_comp_cmd_lvremove() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[A]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_logicalvolumes + _comp_cmd_lvm__logicalvolumes fi } && - complete -F _lvremove lvremove + complete -F _comp_cmd_lvremove lvremove -_lvrename() +_comp_cmd_lvrename() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[A]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_logicalvolumes + _comp_cmd_lvm__logicalvolumes fi } && - complete -F _lvrename lvrename + complete -F _comp_cmd_lvrename lvrename -_lvreduce() +_comp_cmd_lvreduce() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[AL]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --size | -!(-*)L) - _lvm_sizes + --size | -${noargopts}L) + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - _lvm_logicalvolumes + _comp_cmd_lvm__logicalvolumes fi } && - complete -F _lvreduce lvreduce + complete -F _comp_cmd_lvreduce lvreduce -_lvresize() +_comp_cmd_lvresize() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[AL]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --size | -!(-*)L) - _lvm_sizes + --size | -${noargopts}L) + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|--autobackup|-L|--size)' - if ((args == 0)); then - _lvm_logicalvolumes + local REPLY + _comp_cmd_lvm__count_args '@(-A|--autobackup|-L|--size)' + if ((REPLY == 0)); then + _comp_cmd_lvm__logicalvolumes else - _lvm_physicalvolumes + _comp_cmd_lvm__physicalvolumes fi fi } && - complete -F _lvresize lvresize + complete -F _comp_cmd_lvresize lvresize -_lvextend() +_comp_cmd_lvextend() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[AL]*)' + # shellcheck disable=SC2254 case $prev in - --autobackup | -!(-*)A) - COMPREPLY=($(compgen -W 'y n' -- "$cur")) + --autobackup | -${noargopts}A) + _comp_compgen -- -W 'y n' return ;; - --size | -!(-*)L) - _lvm_sizes + --size | -${noargopts}L) + _comp_cmd_lvm__sizes return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) + _comp_compgen_usage -- --help else - local args - _lvm_count_args '@(-A|--autobackup|-L|--size)' - if ((args == 0)); then - _lvm_logicalvolumes + local REPLY + _comp_cmd_lvm__count_args '@(-A|--autobackup|-L|--size)' + if ((REPLY == 0)); then + _comp_cmd_lvm__logicalvolumes else - _lvm_physicalvolumes + _comp_cmd_lvm__physicalvolumes fi fi } && - complete -F _lvextend lvextend + complete -F _comp_cmd_lvextend lvextend -_lvm() +_comp_cmd_lvm() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if ((cword == 1)); then - COMPREPLY=($(compgen -W 'dumpconfig help lvchange lvcreate lvdisplay + _comp_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' else case "${words[1]}" in pvchange | pvcreate | pvdisplay | pvmove | pvremove | pvresize | pvs | pvscan | \ @@ -851,11 +895,11 @@ _lvm() vgdisplay | vgexport | vgextend | vgimport | vgmerge | vgmknodes | vgreduce | \ vgremove | vgrename | vgs | vgscan | vgsplit | lvchange | lvcreate | lvdisplay | \ lvextend | lvreduce | lvremove | lvrename | lvresize | lvscan) - _${words[1]} + _comp_command_offset 1 ;; esac fi } && - complete -F _lvm lvm + complete -F _comp_cmd_lvm lvm # ex: filetype=sh |