forked from zsh-users/zsh-completions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_smartmontools
110 lines (104 loc) · 6.32 KB
/
_smartmontools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#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 <[email protected]>
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
_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)'{-s,--smart}'[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 "$@"