dotfiles/zsh/modules/completion/external/src/_smartmontools

116 lines
6.3 KiB
Plaintext
Raw Normal View History

2018-04-05 13:06:54 +02:00
#compdef smartctl smartd
# ------------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for smartmontools (http://smartmontools.sourceforge.net).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
#
# ------------------------------------------------------------------------------
_smartctl() {
local context state line expl
local -A opt_args
_arguments -A "-*" \
'(-h --help --usage)'{-h,--help,--usage}'[Show help message]' \
'(-V --version --copyright --license)'{-v,--version,--copyright,--license}'[Print license, copyright, and version information and exit]' \
'(-i --info)'{-i,--info}'[Show identity information for device]' \
'(-a --all)'{-a,--all}"[Show all SMART information for device]" \
'(-x --xall)'{-xa,--xall}"[Show all information for device]" \
'--scan[Scan for devices]' \
'--scan-open[Scan for devices and try to open each device]' \
\
'(-q --quietmode)'{-q,--quietmode}'[Set smartctl quiet mode]:TYPE:(errorsonly silent noserial)' \
'(-d --device)'{-d,--device}'[Specify device type]:TYPE:(ata scsi sat usbcypress usbjmicron usbsunplus marvell areca 3ware hpt megaraid cciss auto test)' \
'(-T --tolerance)'{-T,--tolerance}'[Set tolerance]:TOLERANCE:(normal conservative permissive verypermissive)' \
'(-b --badsum)'{-q,--badsum}'[Set action on bad checksum]:TYPE:(warn exit ignore)' \
'(-r --report)'{-r,--report}'[Report transactions]:TYPE:' \
'(-n --nocheck)'{-n,--nocheck}'[No check if MODE]:MODE:(never sleep standby idle)' \
\
'(-s --smart)'{-s,--smart}'[Enable/disable SMART on device]:VALUE:(on off)' \
'(-o --offlineauto)'{-o,--offlineauto}'[Enable/disable automatic offline testing on device]:VALUE:(on off)' \
'(-S --saveauto)'{-S,--saveauto}'[Enable/disable attribute autosave on device]:VALUE:(on off)' \
\
'(-H --health)'{-H,--health}'[Show device SMART health status]' \
'(-c --capabilities)'{-c,--capabilities}'[Show device SMART capabilities]' \
'(-A --attributes)'{-A,--attributes}'[Show device SMART vendor-specific attributes and values]' \
'(-f --format)'{-f,--format}'[Set output format for attributes]:FORMAT:(old brief)' \
'(-l --log)'{-l,--log}'[Show device log]:TYPE:(error selftest selective directory background sasphy sataphy scttemp scterc gplog smartlog xerror xselftest)' \
'(-v --vendorattribute)'{-v,--vendorattribute}'[Set display option for vendor attribute]:N,OPTION:' \
'(-F --firmwarebug)'{-F,--firmwarebug}'[Use firmware bug workaround]:TYPE:(none samsung samsung2 samsung3 swapid)' \
'(-P --presets)'{-P,--presets}'[Drive-specific presets]:TYPE:(use ignore show showall)' \
'(-B --drivedb)'{-B,--drivedb}'[Read and replace drive database from file]:FILE:_files' \
\
'(-t --test)'{-t,--test}'[Run test]:TEST:(offline short long conveyance vendor select pending afterselect,on afterselect,off scttempint)' \
'(-C --captive)'{-C,--captive}'[Do test in captive mode]' \
'(-X --abort)'{-X,--abort}'[Abort any non-captive test on device]' \
\
'1:Device:_files'
}
_smartd() {
local context state line expl
local -A opt_args
_arguments -A "-*" \
'(-h --help --usage)'{-h,--help,--usage}'[Show help message]' \
'(-V --version --copyright --license)'{-v,--version,--copyright,--license}'[Print license, copyright, and version information and exit]' \
\
'(-A --attributelog)'{-A,--attributelog}'[Log ATA attribute information to {PREFIX}MODEL-SERIAL.ata.csv]:PREFIX:' \
'(-B --drivedb)'{-B,--drivedb}'[Read and replace drive database from file]:FILE:_files' \
'(-c --configfile)'{-c,--configfile}'[Read configuration file or stdin]:FILE:_files' \
'(-d --debug)'{-d,--debug}'[Start smartd in debug mode]' \
'(-D --showdirectives)'{-D,--showdirectives}'[Print the configuration file directives and exit]' \
'(-i --interval)'{-i,--interval}'[Set interval between disk checks to N seconds, where N >= 10]:Seconds >= 10:' \
'(-l --logfacility)'{-l,--logfacility}'[Use syslogfacility local0 - local7 or daemon]:FACILITY:(local0 local1 local2 local3 local4 local5 local6 local7)' \
'(-n --no-fork)'{-n,--no-fork}'[Do not fork into background]' \
'(-p --pidfile)'{-p,--pidfile}'[Write PID file]:FILE:_files' \
'(-q --quit)'{-q,--quit}'[Quit on...]:WHEN:(nodev errors nodevstartup never onecheck showtests)' \
'(-r --report)'{-r,--report}'[Report transactions for...]:TYPE:(ioctl ataioctl scsiioctl)' \
'(-s --savestates)'{-s,--savestates}'[Save disk states to {PREFIX}MODEL-SERIAL.TYPE.state]:TYPE:'
}
_smartmontools() {
local ret=1
_call_function ret _$service
return ret
}
_smartmontools "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et