smartctl completion improvements.
This commit is contained in:
parent
d852c18d41
commit
5c48e85a86
2
CHANGES
2
CHANGES
@ -1,7 +1,7 @@
|
|||||||
bash-completion (2.x)
|
bash-completion (2.x)
|
||||||
|
|
||||||
[ Ville Skyttä ]
|
[ Ville Skyttä ]
|
||||||
* Improve gendiff completion.
|
* Improve gendiff and smartctl completions.
|
||||||
* Try harder to find the correct perl executable to run the perl helper with.
|
* Try harder to find the correct perl executable to run the perl helper with.
|
||||||
* Drop rpm query support for rpm < 4.1.
|
* Drop rpm query support for rpm < 4.1.
|
||||||
* Split rpm and rpmbuild completions and improve them both.
|
* Split rpm and rpmbuild completions and improve them both.
|
||||||
|
@ -8,11 +8,37 @@ _smartctl_quietmode()
|
|||||||
}
|
}
|
||||||
_smartctl_device()
|
_smartctl_device()
|
||||||
{
|
{
|
||||||
local i opts='ata scsi sat marvell hpt cciss'
|
case $cur in
|
||||||
|
areca*|3ware*|megaraid*|cciss*)
|
||||||
|
local i mycur="${cur%%,*}"
|
||||||
for (( i=0; i <= 31; i++ )) ; do
|
for (( i=0; i <= 31; i++ )) ; do
|
||||||
opts="$opts 3ware,$i"
|
COMPREPLY=( "${COMPREPLY[@]}" "$mycur,$i" )
|
||||||
done
|
done
|
||||||
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
hpt*)
|
||||||
|
local l m n
|
||||||
|
for (( l=1; l <= 4; l++ )) ; do
|
||||||
|
for (( m=1; m <= 8; m++ )) ; do
|
||||||
|
COMPREPLY=( "${COMPREPLY[@]}" hpt,$l/$m )
|
||||||
|
for (( n=1; n <= 5; n++ )) ; do
|
||||||
|
COMPREPLY=( "${COMPREPLY[@]}" hpt,$l/$m/$n )
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $( compgen -W "ata scsi sat usbcypress usbjmicron
|
||||||
|
usbsunplus marvell areca 3ware hpt megaraid cciss auto test" \
|
||||||
|
-- "$cur" ) )
|
||||||
|
case "${COMPREPLY[@]}" in
|
||||||
|
areca|3ware|hpt|megaraid|cciss)
|
||||||
|
type compopt &>/dev/null && compopt -o nospace
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
_smartctl_tolerance()
|
_smartctl_tolerance()
|
||||||
{
|
{
|
||||||
@ -37,7 +63,9 @@ _smartctl_feature()
|
|||||||
}
|
}
|
||||||
_smartctl_log()
|
_smartctl_log()
|
||||||
{
|
{
|
||||||
COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W 'error selftest selective directory background
|
||||||
|
sasphy sasphy,reset sataphy sataphy,reset scttemp scttempsts
|
||||||
|
scttemphist scterc gplog smartlog xerror xselftest' -- "$cur" ) )
|
||||||
}
|
}
|
||||||
_smartctl_vendorattribute()
|
_smartctl_vendorattribute()
|
||||||
{
|
{
|
||||||
@ -57,10 +85,23 @@ _smartctl_presets()
|
|||||||
}
|
}
|
||||||
_smartctl_test()
|
_smartctl_test()
|
||||||
{
|
{
|
||||||
COMPREPLY=( $( compgen -W 'offline short long conveyance select \
|
[[ $cur == @(pending|scttempint|vendor), ]] && return 0
|
||||||
afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W 'offline short long conveyance select,
|
||||||
|
select,redo select,next afterselect,on afterselect,off pending,
|
||||||
|
scttempint, vendor,' -- "$cur" ) )
|
||||||
|
[[ ${#COMPREPLY[@]} -eq 1 && "${COMPREPLY[@]}" == *, ]] && \
|
||||||
|
type compopt &>/dev/null && compopt -o nospace
|
||||||
|
}
|
||||||
|
_smartctl_drivedb()
|
||||||
|
{
|
||||||
|
local prefix=
|
||||||
|
if [[ $cur == +* ]] ; then
|
||||||
|
prefix=+
|
||||||
|
cur="${cur#+}"
|
||||||
|
fi
|
||||||
|
_filedir h
|
||||||
|
[[ -n $prefix ]] && COMPREPLY=( "${COMPREPLY[@]/#/$prefix}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_smartctl()
|
_smartctl()
|
||||||
{
|
{
|
||||||
@ -115,6 +156,10 @@ _smartctl()
|
|||||||
_smartctl_presets
|
_smartctl_presets
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
-B|--drivedb)
|
||||||
|
_smartctl_drivedb
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
-t|--test)
|
-t|--test)
|
||||||
_smartctl_test
|
_smartctl_test
|
||||||
return 0
|
return 0
|
||||||
@ -124,11 +169,11 @@ _smartctl()
|
|||||||
$split && return 0
|
$split && return 0
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--help --version --info --all --quietmode \
|
COMPREPLY=( $( compgen -W '--help --version --info --all --xall
|
||||||
--device --tolerance --badsum --report --nocheck --smart \
|
--scan --scan-open --quietmode --device --tolerance --badsum
|
||||||
--offlineauto --saveauto --health --capabilities --attributes \
|
--report --nocheck --smart --offlineauto --saveauto --health
|
||||||
--log --vendorattribute --firmwarebug --presets --test --captive \
|
--capabilities --attributes --log --vendorattribute --firmwarebug
|
||||||
--abort' -- "$cur" ) )
|
--presets --drivedb --test --captive --abort' -- "$cur" ) )
|
||||||
else
|
else
|
||||||
cur=${cur:=/dev/}
|
cur=${cur:=/dev/}
|
||||||
_filedir
|
_filedir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user