smartctl completion by Guillaume Rousse <Guillaume.Rousse@inria.fr>.
This commit is contained in:
parent
7500ad3787
commit
ad729ea84b
194
bash_completion
194
bash_completion
@ -1,7 +1,7 @@
|
|||||||
# bash_completion - programmable completion functions for bash 3.x
|
# bash_completion - programmable completion functions for bash 3.x
|
||||||
# (backwards compatible with bash 2.05b)
|
# (backwards compatible with bash 2.05b)
|
||||||
#
|
#
|
||||||
# $Id: bash_completion,v 1.854 2006/02/24 23:55:13 ianmacd Exp $
|
# $Id: bash_completion,v 1.855 2006/02/25 00:24:16 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -8394,6 +8394,198 @@ _ntpdate()
|
|||||||
} &&
|
} &&
|
||||||
complete -F _ntpdate 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=${COMP_WORDS[COMP_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
|
||||||
|
}
|
||||||
|
|
||||||
_filedir_xspec()
|
_filedir_xspec()
|
||||||
{
|
{
|
||||||
local IFS cur xspec
|
local IFS cur xspec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user