summaryrefslogtreecommitdiffstats
path: root/completions/smartctl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
commit6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch)
tree0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/smartctl
parentReleasing progress-linux version 1:2.11-8~progress7.99u1. (diff)
downloadbash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz
bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/smartctl')
-rw-r--r--completions/smartctl151
1 files changed, 53 insertions, 98 deletions
diff --git a/completions/smartctl b/completions/smartctl
index ee45a7c..376ceb8 100644
--- a/completions/smartctl
+++ b/completions/smartctl
@@ -1,26 +1,17 @@
# bash completion for smartctl(8) -*- shell-script -*-
-_smartctl_quietmode()
-{
- COMPREPLY=($(compgen -W 'errorsonly silent noserial' -- "$cur"))
-}
-_smartctl_device()
+_comp_cmd_smartctl__device()
{
case $cur in
areca* | 3ware* | megaraid* | cciss*)
- # shellcheck disable=SC2054
- COMPREPLY+=(${cur%%,*},{0..31})
- COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$cur"))
+ _comp_compgen -- -W '${cur%%,*},{0..31}'
;;
hpt*)
- # shellcheck disable=SC2054
- COMPREPLY+=(hpt,{1..4}/{1..8} hpt,{1..4}/{1..8}/{1..5})
- COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$cur"))
+ _comp_compgen -- -W 'hpt,{1..4}/{1..8} hpt,{1..4}/{1..8}/{1..5}'
;;
*)
- COMPREPLY=($(compgen -W "ata scsi sat usbcypress usbjmicron
- usbsunplus marvell areca 3ware hpt megaraid cciss auto test" \
- -- "$cur"))
+ _comp_compgen -- -W 'ata scsi sat usbcypress usbjmicron usbsunplus
+ marvell areca 3ware hpt megaraid cciss auto test'
case "${COMPREPLY[@]}" in
areca | 3ware | hpt | megaraid | cciss)
compopt -o nospace
@@ -29,137 +20,101 @@ _smartctl_device()
;;
esac
}
-_smartctl_tolerance()
-{
- COMPREPLY=($(compgen -W 'normal conservative permissive verypermissive' \
- -- "$cur"))
-}
-_smartctl_badsum()
-{
- COMPREPLY=($(compgen -W 'warn exit ignore' -- "$cur"))
-}
-_smartctl_report()
-{
- COMPREPLY=($(compgen -W 'ioctl ataioctl scsiioctl' -- "$cur"))
-}
-_smartctl_powermode()
-{
- COMPREPLY=($(compgen -W 'never sleep standby idle' -- "$cur"))
-}
-_smartctl_feature()
-{
- COMPREPLY=($(compgen -W 'on off' -- "$cur"))
-}
-_smartctl_log()
-{
- 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()
-{
- 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 samsung3 swapid' \
- -- "$cur"))
-}
-_smartctl_presets()
-{
- COMPREPLY=($(compgen -W 'use ignore show showall' -- "$cur"))
-}
-_smartctl_test()
+_comp_cmd_smartctl__test()
{
[[ $cur == @(pending|scttempint|vendor), ]] && return
- COMPREPLY=($(compgen -W 'offline short long conveyance select,
- select,redo select,next afterselect,on afterselect,off pending,
- scttempint, vendor,' -- "$cur"))
+ _comp_compgen -- -W 'offline short long conveyance select, select,redo
+ select,next afterselect,on afterselect,off pending, scttempint,
+ vendor,'
[[ ${COMPREPLY-} == *, ]] && compopt -o nospace
}
-_smartctl_drivedb()
+_comp_cmd_smartctl__drivedb()
{
local prefix=
if [[ $cur == +* ]]; then
prefix=+
cur="${cur#+}"
fi
- _filedir h
- [[ -n $prefix ]] && COMPREPLY=("${COMPREPLY[@]/#/$prefix}")
+ _comp_compgen_filedir h && [[ $prefix ]] &&
+ _comp_compgen -Rv COMPREPLY -- -P "$prefix" -W '"${COMPREPLY[@]}"'
}
-_smartctl()
+_comp_cmd_smartctl()
{
- local cur prev words cword split
- _init_completion -s || return
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
+ local noargopts='!(-*|*[qdTbrnsoSlvFPBt]*)'
+ # shellcheck disable=SC2254
case $prev in
- --quietmode | -!(-*)q)
- _smartctl_quietmode
+ --quietmode | -${noargopts}q)
+ _comp_compgen -- -W 'errorsonly silent noserial'
+ return
;;
- --device | -!(-*)d)
- _smartctl_device
+ --device | -${noargopts}d)
+ _comp_cmd_smartctl__device
return
;;
- --tolerance | -!(-*)T)
- _smartctl_tolerance
+ --tolerance | -${noargopts}T)
+ _comp_compgen -- -W 'normal conservative permissive verypermissive'
return
;;
- --badsum | -!(-*)b)
- _smartctl_badsum
+ --badsum | -${noargopts}b)
+ _comp_compgen -- -W 'warn exit ignore'
return
;;
- --report | -!(-*)r)
- _smartctl_report
+ --report | -${noargopts}r)
+ _comp_compgen -- -W 'ioctl ataioctl scsiioctl'
return
;;
- --nocheck | -!(-*)n)
- _smartctl_powermode
+ --nocheck | -${noargopts}n)
+ _comp_compgen -- -W 'never sleep standby idle'
return
;;
- --smart | --offlineauto | --saveauto | -!(-*)[soS])
- _smartctl_feature
+ --smart | --offlineauto | --saveauto | -${noargopts}[soS])
+ _comp_compgen -- -W 'on off'
return
;;
- --log | -!(-*)l)
- _smartctl_log
+ --log | -${noargopts}l)
+ _comp_compgen -- -W 'error selftest selective directory background
+ sasphy sasphy,reset sataphy sataphy,reset scttemp scttempsts
+ scttemphist scterc gplog smartlog xerror xselftest'
return
;;
- --vendorattribute | -!(-*)v)
- _smartctl_vendorattribute
+ --vendorattribute | -${noargopts}v)
+ _comp_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'
return
;;
- --firmwarebug | -!(-*)F)
- _smartctl_firmwarebug
+ --firmwarebug | -${noargopts}F)
+ _comp_compgen -- -W 'none samsung samsung2 samsung3 swapid'
return
;;
- --presets | -!(-*)P)
- _smartctl_presets
+ --presets | -${noargopts}P)
+ _comp_compgen -- -W 'use ignore show showall'
return
;;
- --drivedb | -!(-*)B)
- _smartctl_drivedb
+ --drivedb | -${noargopts}B)
+ _comp_cmd_smartctl__drivedb
return
;;
- --test | -!(-*)t)
- _smartctl_test
+ --test | -${noargopts}t)
+ _comp_cmd_smartctl__test
return
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ _comp_compgen_help
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
else
- cur=${cur:=/dev/}
- _filedir
+ _comp_compgen -c "${cur:-/dev/}" filedir
fi
} &&
- complete -F _smartctl smartctl
+ complete -F _comp_cmd_smartctl smartctl
# ex: filetype=sh