smartctl reviewed and improved.
This commit is contained in:
parent
4a2ba6a38d
commit
ee1f7542de
4
CHANGES
4
CHANGES
@ -35,12 +35,13 @@ bash-completion (1.x)
|
||||
* Add _split_longopt() helper for improved handling of long options that
|
||||
take arguments in both "--foo bar" and "--foo=bar" formats.
|
||||
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
||||
iptables, make, and generic long option completion.
|
||||
iptables, make, smartctl, and generic long option completion.
|
||||
* Add chown --from and --reference value completions.
|
||||
* Add chgrp --reference value completion.
|
||||
* Do not assume all --foo= options take filenames in generic long option
|
||||
completion, assume only that --*file*= does, and that --*dir*= takes dirs.
|
||||
* Add make --old/new-file, --assume-old/new, --what-if value completions.
|
||||
* Add smartctl -n/--nocheck completion, add more other value completions.
|
||||
|
||||
[ Todd Zullinger ]
|
||||
* Make yum complete on filenames after install, deplist, update and upgrade
|
||||
@ -51,6 +52,7 @@ bash-completion (1.x)
|
||||
|
||||
[ Guillaume Rousse ]
|
||||
* Split mkinitrd completion to contrib/mkinitrd, improve it.
|
||||
* Split smartctl completion to contrib/smartctl.
|
||||
|
||||
[ Raphaël Droz ]
|
||||
* Add mount -L and -U completion.
|
||||
|
@ -42,6 +42,7 @@ bashcomp_DATA = contrib/apache2ctl \
|
||||
contrib/sbcl \
|
||||
contrib/screen \
|
||||
contrib/sitecopy \
|
||||
contrib/smartctl \
|
||||
contrib/snownews \
|
||||
contrib/ssh \
|
||||
contrib/_subversion \
|
||||
|
192
bash_completion
192
bash_completion
@ -8391,198 +8391,6 @@ _ntpdate()
|
||||
} &&
|
||||
complete -F _ntpdate ntpdate
|
||||
|
||||
# smartctl(8) completion
|
||||
#
|
||||
have smartctl && {
|
||||
_smartctl_quietmode()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) )
|
||||
}
|
||||
_smartctl_device()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) )
|
||||
}
|
||||
_smartctl_tolerance()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) )
|
||||
}
|
||||
_smartctl_badsum()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) )
|
||||
}
|
||||
_smartctl_report()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) )
|
||||
}
|
||||
_smartctl_feature()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
|
||||
}
|
||||
_smartctl_log()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) )
|
||||
}
|
||||
_smartctl_vendorattribute()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
|
||||
9,temp 192,emergencyretractcyclect 193,loadunload \
|
||||
194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
|
||||
200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) )
|
||||
}
|
||||
_smartctl_firmwarebug()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) )
|
||||
}
|
||||
_smartctl_presets()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) )
|
||||
}
|
||||
_smartctl_test()
|
||||
{
|
||||
COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) )
|
||||
}
|
||||
|
||||
_smartctl()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
# --name value style option
|
||||
case "$prev" in
|
||||
-q)
|
||||
_smartctl_quietmode
|
||||
;;
|
||||
-d)
|
||||
_smartctl_device
|
||||
return 0
|
||||
;;
|
||||
-t)
|
||||
_smartctl_tolerance
|
||||
return 0
|
||||
;;
|
||||
-b)
|
||||
_smartctl_badsum
|
||||
return 0
|
||||
;;
|
||||
-r)
|
||||
_smartctl_report
|
||||
return 0
|
||||
;;
|
||||
-s)
|
||||
_smartctl_feature
|
||||
return 0
|
||||
;;
|
||||
-o)
|
||||
_smartctl_feature
|
||||
return 0
|
||||
;;
|
||||
-S)
|
||||
_smartctl_feature
|
||||
return 0
|
||||
;;
|
||||
-l)
|
||||
_smartctl_log
|
||||
return 0
|
||||
;;
|
||||
-v)
|
||||
_smartctl_vendorattribute
|
||||
return 0
|
||||
;;
|
||||
-F)
|
||||
_smartctl_firmwarebug
|
||||
return 0
|
||||
;;
|
||||
-P)
|
||||
_smartctl_presets
|
||||
return 0
|
||||
;;
|
||||
-t)
|
||||
_smartctl_test
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# --name=value style option
|
||||
if [[ "$cur" == *=* ]]; then
|
||||
prev=${cur/=*/}
|
||||
cur=${cur/*=/}
|
||||
case "$prev" in
|
||||
--quietmode)
|
||||
_smartctl_quietmode
|
||||
return 0
|
||||
;;
|
||||
--device)
|
||||
_smartctl_device
|
||||
return 0
|
||||
;;
|
||||
--tolerance)
|
||||
_smartctl_tolerance
|
||||
return 0
|
||||
;;
|
||||
--badsum)
|
||||
_smartctl_badsum
|
||||
return 0
|
||||
;;
|
||||
--report)
|
||||
_smartctl_report
|
||||
return 0
|
||||
;;
|
||||
--smart)
|
||||
_smartctl_feature
|
||||
return 0
|
||||
;;
|
||||
--offlineauto)
|
||||
_smartctl_feature
|
||||
return 0
|
||||
;;
|
||||
--saveauto)
|
||||
_smartctl_feature
|
||||
return 0
|
||||
;;
|
||||
--log)
|
||||
_smartctl_log
|
||||
return 0
|
||||
;;
|
||||
--vendorattribute)
|
||||
_smartctl_vendorattribute
|
||||
return 0
|
||||
;;
|
||||
--firmwarebug)
|
||||
_smartctl_firmwarebug
|
||||
return 0
|
||||
;;
|
||||
--presets)
|
||||
_smartctl_presets
|
||||
return 0
|
||||
;;
|
||||
--test)
|
||||
_smartctl_test
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
|
||||
--copyright --license-i --info -a --all -q \
|
||||
--quietmode= -d --device= -T --tolerance= -b --badsum= \
|
||||
-r --report= -s --smart= -o --offlineauto= -S \
|
||||
--saveauto= -H --health -c --capabilities -A \
|
||||
--attributes -l --log= -v --vendorattribute= -F \
|
||||
--firmwarebug= -P --presets= -t --test= -C \
|
||||
--captive -X --abort' -- $cur ) )
|
||||
else
|
||||
cur=${cur:=/dev/}
|
||||
_filedir
|
||||
fi
|
||||
}
|
||||
complete -F _smartctl smartctl
|
||||
}
|
||||
|
||||
# sysctl(8) completion
|
||||
#
|
||||
have sysctl &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user