959 lines
21 KiB
Plaintext
Raw Normal View History

# bash completion for lvm -*- shell-script -*-
2009-05-17 21:59:04 +02:00
_lvm_volumegroups()
2009-05-17 21:59:04 +02:00
{
2009-10-04 19:42:50 +02:00
COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) )
2009-05-17 21:59:04 +02:00
}
_lvm_physicalvolumes()
2009-05-17 21:59:04 +02:00
{
2009-10-04 19:42:50 +02:00
COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) )
2009-05-17 21:59:04 +02:00
}
_lvm_logicalvolumes()
2009-05-17 21:59:04 +02:00
{
2009-10-04 19:42:50 +02:00
COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) )
if [[ $cur == /dev/mapper/* ]]; then
_filedir
local i
for i in ${!COMPREPLY[@]}; do
[[ ${COMPREPLY[i]} == */control ]] && unset COMPREPLY[i]
done
fi
2009-05-17 21:59:04 +02:00
}
_lvm_units()
2009-05-17 21:59:04 +02:00
{
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) )
2009-05-17 21:59:04 +02:00
}
_lvm_sizes()
2009-05-17 21:59:04 +02:00
{
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'k K m M g G t T' -- "$cur" ) )
2009-05-17 21:59:04 +02:00
}
# @param $1 glob matching args known to take an argument
_lvm_count_args()
2009-05-17 21:59:04 +02:00
{
2009-10-04 19:42:50 +02:00
args=0
local offset=1
if [[ "${words[0]}" == lvm ]]; then
2009-10-04 19:42:50 +02:00
offset=2
fi
local i prev=${words[$offset-1]}
for (( i=$offset; i < cword; i++ )); do
if [[ "${words[i]}" != -* && $prev != $1 ]]; then
2009-10-04 19:42:50 +02:00
args=$(($args + 1))
fi
prev=${words[i]}
2009-10-04 19:42:50 +02:00
done
2009-05-17 21:59:04 +02:00
}
_lvmdiskscan()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvmdiskscan lvmdiskscan
_pvscan()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup --help
--ignorelockingfailure --partial --short --uuid --verbose
--version' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvscan pvscan
_pvs()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-o|-O|--options|--sort)
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" ) )
2009-10-04 19:42:50 +02:00
return 0
;;
--units)
_lvm_units
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvs pvs
_pvdisplay()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
2009-10-04 19:42:50 +02:00
--units)
_lvm_units
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvdisplay pvdisplay
_pvchange()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|-x|--autobackup|--allocatable)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvchange pvchange
_pvcreate()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
2009-10-04 19:42:50 +02:00
--restorefile)
_filedir
return 0
;;
-M|--metadatatype)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
--metadatacopies)
COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
return 0
;;
--metadatasize|--setphysicalvolumesize)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvcreate pvcreate
_pvmove()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-n|--name)
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
return 0
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--abort --autobackup --background --debug
--force --help --interval --test --verbose --version --name' \
-- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvmove pvmove
_pvremove()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _pvremove pvremove
_vgscan()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgscan vgscan
_vgs()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-o|-O|--options|--sort)
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" ) )
2009-10-04 19:42:50 +02:00
return 0
;;
--units)
_lvm_units
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgs vgs
_vgdisplay()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
2009-10-04 19:42:50 +02:00
--units)
_lvm_units
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgdisplay vgdisplay
_vgchange()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-a|-A|-x|--available|--autobackup|--resizeable)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--autobackup --alloc --partial --debug
--help --ignorelockingfailure --test --uuid --verbose --version
--available --resizeable --logicalvolume --addtag --deltag' \
-- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgchange vgchange
_vgcreate()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-M|--metadatatype)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
-s|--physicalextentsize)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc --debug --help
--maxlogicalvolumes --metadatatype --maxphysicalvolumes
--physicalextentsize --test --verbose --version' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|--autobackup|-M|--metadatatype|-s|--physicalextentsize)
2011-11-09 23:28:11 +02:00
if [[ $args -eq 0 ]]; then
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgcreate vgcreate
_vgremove()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgremove vgremove
_vgrename()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgrename vgrename
_vgreduce()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|--autobackup)
2011-11-09 23:28:11 +02:00
if [[ $args -eq 0 ]]; then
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgreduce vgreduce
_vgextend()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-L|--size)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|--autobackup|-L|--size)
2011-11-09 23:28:11 +02:00
if [[ $args -eq 0 ]]; then
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgextend vgextend
_vgport()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgport vgimport vgexport
_vgck()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgck vgck
_vgconvert()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-M|--metadatatype)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
--metadatacopies)
COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
return 0
;;
--metadatasize)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgconvert vgconvert
_vgcfgbackup()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-f|--file)
2009-10-04 19:42:50 +02:00
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgcfgbackup vgcfgbackup
_vgcfgrestore()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-f|--file)
2009-10-04 19:42:50 +02:00
_filedir
return 0
;;
-M|--metadatatype)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
-n|--name)
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgcfgrestore vgcfgrestore
_vgmerge()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgmerge vgmerge
_vgsplit()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-M|--metadatatype)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--autobackup --debug --help --list
--metadatatype --test --verbose --version' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|--autobackup|-M|--metadatatype)
if [[ $args -eq 0 || $args -eq 1 ]]; then
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgsplit vgsplit
_vgmknodes()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _vgmknodes vgmknodes
_lvscan()
{
local cur prev words cword
_init_completion || return
2009-05-17 21:59:04 +02:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvscan lvscan
_lvs()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-o|-O|--options|--sort)
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" ) )
2009-10-04 19:42:50 +02:00
return 0
;;
--units)
_lvm_units
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvs lvs
_lvdisplay()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
2009-10-04 19:42:50 +02:00
--units)
_lvm_units
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvdisplay lvdisplay
_lvchange()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-a|-A|-C|-M|--available|--autobackup|--contiguous|--persistent)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-p|--permission)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvchange lvchange
_lvcreate()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-L|--size)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
-p|--permission)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
return 0
;;
-n|--name)
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|-C|-M|-Z|--autobackup|--contiguous|--persistent|--zero|-L|--size|-p|--permission|-n|--name)
2011-11-09 23:28:11 +02:00
if [[ $args -eq 0 ]]; then
_lvm_volumegroups
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvcreate lvcreate
_lvremove()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvremove lvremove
_lvrename()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvrename lvrename
_lvreduce()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-L|--size)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvreduce lvreduce
_lvresize()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-L|--size)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|--autobackup|-L|--size)
2011-11-09 23:28:11 +02:00
if [[ $args -eq 0 ]]; then
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvresize lvresize
_lvextend()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
case $prev in
-A|--autobackup)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
-L|--size)
_lvm_sizes
2009-10-04 19:42:50 +02:00
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
2009-10-04 19:42:50 +02:00
else
local args
_lvm_count_args @(-A|--autobackup|-L|--size)
2011-11-09 23:28:11 +02:00
if [[ $args -eq 0 ]]; then
_lvm_logicalvolumes
2009-10-04 19:42:50 +02:00
else
_lvm_physicalvolumes
2009-10-04 19:42:50 +02:00
fi
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvextend lvextend
_lvm()
{
local cur prev words cword
_init_completion || return
2009-10-04 19:42:50 +02:00
2011-11-09 23:28:11 +02:00
if [[ $cword -eq 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" ) )
2009-10-04 19:42:50 +02:00
else
case ${words[1]} in
2009-10-04 19:42:50 +02:00
pvchange)
_pvchange
;;
pvcreate)
_pvcreate
;;
pvdisplay)
_pvdisplay
;;
pvmove)
_pvmove
;;
pvremove)
_pvremove
;;
pvresize)
_pvresize
;;
pvs)
_pvs
;;
pvscan)
_pvscan
;;
vgcfgbackup)
_vgcfgbackup
;;
vgcfgrestore)
_vgcfgrestore
;;
vgchange)
_vgchange
;;
vgck)
_vgck
;;
vgconvert)
_vgconvert
;;
vgcreate)
_vgcreate
;;
vgdisplay)
_vgdisplay
;;
vgexport)
_vgexport
;;
vgextend)
_vgextend
;;
vgimport)
_vgimport
;;
vgmerge)
_vgmerge
;;
vgmknodes)
_vgmknodes
;;
vgreduce)
_vgreduce
;;
vgremove)
_vgremove
;;
vgrename)
_vgrename
;;
vgs)
_vgs
;;
vgscan)
_vgscan
;;
vgsplit)
_vgsplit
;;
lvchange)
_lvchange
;;
lvcreate)
_lvcreate
;;
lvdisplay)
_lvdisplay
;;
lvextend)
_lvextend
;;
lvreduce)
_lvreduce
;;
lvremove)
_lvremove
;;
lvrename)
_lvrename
;;
lvresize)
_lvresize
;;
lvs)
_lvs
;;
lvscan)
_lvscan
;;
esac
fi
2011-04-04 22:14:39 +03:00
} &&
2009-05-17 21:59:04 +02:00
complete -F _lvm lvm
2009-10-04 19:42:50 +02:00
# ex: ts=4 sw=4 et filetype=sh