summaryrefslogtreecommitdiff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Linux/Command/_mdadm10
-rw-r--r--Completion/Linux/Command/_strace39
-rw-r--r--Completion/Solaris/Command/.distfiles11
-rw-r--r--Completion/Solaris/Command/_beadm76
-rw-r--r--Completion/Solaris/Command/_dladm562
-rw-r--r--Completion/Solaris/Command/_dtrace41
-rw-r--r--Completion/Solaris/Command/_flowadm115
-rw-r--r--Completion/Solaris/Command/_fmadm111
-rw-r--r--Completion/Solaris/Command/_ipadm375
-rw-r--r--Completion/Solaris/Command/_netstat61
-rw-r--r--Completion/Solaris/Command/_pkg5431
-rw-r--r--Completion/Solaris/Command/_prstat45
-rw-r--r--Completion/Solaris/Command/_ps77
-rw-r--r--Completion/Solaris/Command/_snoop87
-rw-r--r--Completion/Solaris/Command/_svcadm43
-rw-r--r--Completion/Solaris/Command/_svccfg19
-rw-r--r--Completion/Solaris/Command/_svcprop3
-rw-r--r--Completion/Solaris/Command/_zlogin17
-rw-r--r--Completion/Solaris/Command/_zoneadm147
-rw-r--r--Completion/Solaris/Type/.distfiles2
-rw-r--r--Completion/Solaris/Type/_be_name18
-rw-r--r--Completion/Solaris/Type/_svcs_fmri48
-rw-r--r--Completion/Solaris/Type/_zones13
-rw-r--r--Completion/Unix/Command/.distfiles4
-rw-r--r--Completion/Unix/Command/_getconf2
-rw-r--r--Completion/Unix/Command/_git1
-rw-r--r--Completion/Unix/Command/_gradle114
-rw-r--r--Completion/Unix/Command/_init_d1
-rw-r--r--Completion/Unix/Command/_mosh12
-rw-r--r--Completion/Unix/Command/_mount9
-rw-r--r--Completion/Unix/Command/_quilt22
-rw-r--r--Completion/Unix/Command/_ssh13
-rw-r--r--Completion/Unix/Command/_systemctl311
-rw-r--r--Completion/Unix/Command/_systemd459
-rw-r--r--Completion/Unix/Command/_tmux26
-rw-r--r--Completion/Unix/Command/_wget2
-rw-r--r--Completion/Unix/Command/_xmlsoft6
-rw-r--r--Completion/Unix/Command/_zfs342
-rw-r--r--Completion/Unix/Command/_zpool190
-rw-r--r--Completion/Unix/Type/.distfiles2
-rw-r--r--Completion/Unix/Type/_pdf2
-rw-r--r--Completion/Unix/Type/_ps1234109
-rw-r--r--Completion/Unix/Type/_zfs_dataset70
-rw-r--r--Completion/Unix/Type/_zfs_keysource_props15
-rw-r--r--Completion/Zsh/Command/_print116
-rw-r--r--Completion/Zsh/Command/_typeset6
-rw-r--r--Completion/compinit10
47 files changed, 3492 insertions, 703 deletions
diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm
index 461e66617..940eb6887 100644
--- a/Completion/Linux/Command/_mdadm
+++ b/Completion/Linux/Command/_mdadm
@@ -147,7 +147,15 @@ fi
_mds () {
local -a vals
- vals=( ${${${(M)${(f)"$(< /etc/mdadm.conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
+ if [ -r /etc/mdadm.conf ] ; then
+ local mdadm_conf=/etc/mdadm.conf
+ elif [ -r /etc/mdadm/mdadm.conf ] ; then
+ local mdadm_conf=/etc/mdadm/mdadm.conf
+ else
+ _message "could not find mdadm.conf"
+ return 1
+ fi
+ vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
_describe -t mds "RAID devices" vals
_arguments \
"(-h --help)"{-h,--help}'[display a mode specific help message]'
diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace
index 695e800c7..45ebfcf1a 100644
--- a/Completion/Linux/Command/_strace
+++ b/Completion/Linux/Command/_strace
@@ -85,29 +85,34 @@ _expression () {
_arguments \
'()-c[count time, calls, and errors for each system call and report a summary]' \
- -d'[show some debugging output of strace itself on the standard error]' \
- -f'[trace child processes as they are created by currently traced processes]' \
- -ff'[write each process trace to <filename>.<pid> (when using -o <filename>]' \
+ '()-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \
+ '-d[show some debugging output of strace itself on the standard error]' \
+ '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \
+ '-f[trace child processes as they are created by currently traced processes]' \
+ '-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \
'(-c -d -f -ff -i -q -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p -s -S -u -E)-h[print help]' \
- -i'[print the instruction pointer at the time of the system call]' \
- -q'[suppress messages about attaching, detaching etc.]' \
- -r'[print a relative timestamp upon entry to each system call]' \
+ '-i[print the instruction pointer at the time of the system call]' \
+ '-q[suppress messages about attaching, detaching etc.]' \
+ '-r[print a relative timestamp upon entry to each system call]' \
'(-ttt)-t[prefix each line of the trace with the time of day]' \
'(-ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \
'(-tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \
- -T'[show the time spent in system calls]' \
- -v'[print unabbreviated versions of environment, stat, termios, etc. calls]' \
+ '-T[show the time spent in system calls]' \
+ '-y[print paths associated with file descriptor arguments]' \
+ '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \
'(-c -d -f -ff -h -i -q -r -t -tt -ttt -T -v -x -xx -a -e -o -O -p -s -S -u -E)-V[print the version number of strace]' \
'(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \
'(-x)-xx[print all strings in hexadecimal string format]' \
- -a'[align return values in a specific column (default 40)]:column number' \
- '*-e[select events to trace or how to trace]:system call:_expression' \
- '-o[write the trace output to the file]:output file:_files' \
- '-O[overhead for tracing system calls]:overhead microseconds' \
- '(:)-p[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
- '-s[specify the maximum string size to print (default 32)]:maximum string size' \
- '-S[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \
- '-u[run as specified user]:user:_users' \
- '*-E[remove variable from the inherited list of environment or define a value]:variable:_printenv' \
+ '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default if '\''-o FILE PROG'\''" 4\:"fatal signals and SIGTSTP are always blocked"))' \
+ '*-P+[trace only system calls accessing given path]:path:_files' \
+ '-a+[align return values in a specific column (default 40)]:column number' \
+ '*-e+[select events to trace or how to trace]:system call:_expression' \
+ '-o+[write the trace output to the file]:output file:_files' \
+ '-O+[overhead for tracing system calls]:overhead microseconds' \
+ '(:)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
+ '-s+[specify the maximum string size to print (default 32)]:maximum string size' \
+ '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \
+ '-u+[run as specified user]:user:_users' \
+ '*-E+[remove variable from the inherited list of environment or define a value]:variable:_printenv' \
'(-):command name: _command_names -e' \
'*::arguments:_normal'
diff --git a/Completion/Solaris/Command/.distfiles b/Completion/Solaris/Command/.distfiles
index fa3d89ccd..a900851aa 100644
--- a/Completion/Solaris/Command/.distfiles
+++ b/Completion/Solaris/Command/.distfiles
@@ -1,17 +1,28 @@
DISTFILES_SRC='
.distfiles
+_beadm
_coreadm
_dhcpinfo
_dladm
+_dtrace
_dumpadm
+_flowadm
+_fmadm
_gcore
_inetadm
+_ipadm
+_netstat
_pfexec
+_pkg5
+_prstat
+_ps
_ptree
_savecore
+_snoop
_svcadm
_svccfg
_svcprop
_svcs
_zlogin
+_zoneadm
'
diff --git a/Completion/Solaris/Command/_beadm b/Completion/Solaris/Command/_beadm
new file mode 100644
index 000000000..6e498bee3
--- /dev/null
+++ b/Completion/Solaris/Command/_beadm
@@ -0,0 +1,76 @@
+#compdef beadm
+
+_beadm() {
+ local context state line subcmds
+ typeset -A opt_args
+
+ subcmds=( activate create destroy list mount rename unmount )
+
+ if [[ $service == "beadm" ]]; then
+ _arguments -C -A "-*" \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl 'beadm subcommand' compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ (activate)
+ _arguments -A "-*" \
+ ':BE name:_be_name'
+ ;;
+
+ (create)
+ # TODO: Add support for -o, and for creating snapshots
+ _arguments -A "-*" \
+ '-a[Activate new BE]' \
+ '-d[Description]:' \
+ '-e[Base BE]:BE name or snapshot:_be_name -t all' \
+ '-p[Create new BE in specified ZFS pool]:ZFS pool:_zfs_pool' \
+ ':new BE name:'
+ ;;
+
+ (destroy)
+ _arguments -A "-*" \
+ '-f[Unmount BE if necessary]' \
+ "-F[Don't prompt for verification]" \
+ ':BE or BE snapshot:_be_name'
+ ;;
+
+ (list)
+ _arguments -A "-*" \
+ '-a[List subordinate filesystems and snapshots]' \
+ '-d[List subordinate filesystems]' \
+ '-s[List snapshots]' \
+ '-H[Parseable format]' \
+ ':BE name:_be_name'
+ ;;
+
+ (mount)
+ _arguments -A "-*" \
+ ':BE name:_be_name' \
+ ':mountpoint:_path_files -/'
+ ;;
+
+ (rename)
+ _arguments -A "-*" \
+ ':existing BE name:_be_name' \
+ ':new BE name:'
+ ;;
+
+ (unmount)
+ _arguments -A "-*" \
+ '-f[Force unmount]' \
+ ':BE name:_be_name'
+ ;;
+
+ (*)
+ _message "unknown beadm subcommand: $service"
+ esac
+}
+
+_beadm "$@"
diff --git a/Completion/Solaris/Command/_dladm b/Completion/Solaris/Command/_dladm
index 3c1595b52..5e5ab0172 100644
--- a/Completion/Solaris/Command/_dladm
+++ b/Completion/Solaris/Command/_dladm
@@ -1,4 +1,5 @@
#compdef dladm
+# Synced with the S11U1 build 19 man page
_dladm_links() {
compadd "$@" - $(dladm show-link -p -o link)
@@ -36,11 +37,6 @@ _dladm_ethers() {
compadd "$@" - $(dladm show-ether -p -o link)
}
-_dladm_linkprops() {
- # TODO: complete property values, when available
- compadd "$@" - $(dladm show-linkprop -c -o property)
-}
-
_dladm_vnics() {
compadd "$@" - $(dladm show-vnic -p -o link)
}
@@ -49,35 +45,60 @@ _dladm_etherstubs() {
compadd "$@" - $(dladm show-etherstub)
}
+_dladm_bridges() {
+ compadd "$@" - $(dladm show-bridge -p -o bridge)
+}
+
+_dladm_iptuns() {
+ compadd "$@" - $(dladm show-iptun -p -o link)
+}
+
+_dladm_parts() {
+ compadd "$@" - $(dladm show-part -p -o link)
+}
+
+_dladm_iblinks() {
+ compadd "$@" - $(dladm show-ib -p -o link)
+}
+
_dladm() {
local context state line expl
typeset -A opt_args
- local -a subcmds rw_properties rw_propnames ro_properties
- local -a link_properties link_stats_properties
+ local -a subcmds
+ local -a linkprops linkprops_general linkprops_nonvlanvnic linkprops_wifi
+ local -a linkprops_ether linkprops_ib linkprops_iptun
+ local -a link_properties link_stats_properties vnic_properties
local -a aggr_properties aggr_lacp_properties aggr_ext_properties
local -a vlan_properties wifi_properties wifi_connect_properties
local -a ether_properties linkprop_properties secobj_properties
+ local -a bridge_properties bridge_stats_properties bridge_link_properties
+ local -a bridge_link_stats_properties bridge_fwd_properties
+ local -a bridge_fwd_properties bridge_trill_properties
+ local -a iptun_properties tunnel_values part_properties ib_properties
# TODO: some subcommands can take multiple comma-separated targets
# TODO: some option sets may be different based on other commandline flags
# TODO: some subcommands may take different arguments based on options
subcmds=(
- "show-ether" "show-usage"
+ "help" "show-ether" "show-ib" "show-usage"
{"rename","show"}"-link"
{"add","create","delete","modify","remove","show"}"-aggr"
{"connect","disconnect","scan","show"}"-wifi"
{"reset","set","show"}"-linkprop"
{"create","delete","show"}"-secobj"
- {"create","delete","show"}"-vlan"
+ {"create","delete","modify","show"}"-vlan"
{"delete","show"}"-phys"
- {"create","delete","show"}"-vnic"
+ {"create","delete","modify","show"}"-vnic"
{"create","delete","show"}"-etherstub"
+ {"create","modify","delete","add","remove","show"}"-bridge"
+ {"create","modify","delete","show"}"-iptun"
+ {"create","delete","show"}"-part"
)
if [[ $service == "dladm" ]]; then
_arguments -C -A "-*" \
- '-\?[help]' \
+ '-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -88,10 +109,10 @@ _dladm() {
curcontext="${curcontext%:*}=$service:"
fi
- link_properties=( "link" "class" "mtu" "state" "over" )
+ link_properties=( "link" "zone" "class" "mtu" "state" "over" )
link_stats_properties=( "link" "ipackets" "rbytes" "ierrors" "opackets" "obytes" "oerrors" )
- aggr_properties=( "link" "policy" "addrpolicy" "lacpactivity" "lacptimer" "flags" )
+ aggr_properties=( "link" "policy" "addrpolicy" "lacpactivity" "lacptimer" "mode" "flags" )
aggr_lacp_properties=( "link" "port" "aggregatable" "sync" "coll" "dist" "defaulted" "expired" )
aggr_ext_properties=( "link" "port" "speed" "duplex" "state" "address" "portstate" )
@@ -108,34 +129,158 @@ _dladm() {
vnic_properties=( "link" "over" "speed" "macaddr" "macaddrtype" )
+ bridge_properties=( "bridge" "address" "priority" "bmaxage" "bhellotime" "bfwddelay"
+ "forceproto" "tctime" "tccount" "tchange" "desroot" "rootcost" "rootport"
+ "maxage" "hellotime" "fwddelay" "holdtime" )
+ bridge_stats_properties=( "bridge" "drops" "forwards" "mbcast" "recv" "sent" "unknown" )
+ bridge_link_properties=( "link" "index" "state" "uptime" "opercost" "operp2p" "operedge"
+ "desroot" "descost" "desbridge" "desport" "tcack" )
+ bridge_link_stats_properties=( "link" "cfgbpdu" "tcnbpdu" "rstpbpdu" "txbpdu" "drops" "recv" "xmit" )
+ bridge_fwd_properties=( "dest" "age" "flags" "output" )
+ bridge_trill_properties=( "nick" "flags" "link" "nexthop" )
+
+ iptun_properties=( "link" "type" "flags" "local" "remote" )
+ tunnel_values=( "local:address/host: " "remote:address/host: " )
+
+ part_properties=( "link" "pkey" "over" "state" "flags" )
+
+ ib_properties=( "link" "hcaguid" "portguid" "port" "state" "pkeys" )
+
+ linkprops_general=(
+ "autopush:streams modules:"
+ "cos:value:(0 1 2 3 4 5 6 7)"
+ "cpus:processors:"
+ "cpus-effective"
+ "etsbw-lcl:percentage:"
+ "etsbw-lcl-advice"
+ "etsbw-lcl-effective"
+ "etsbw-rmt-effective"
+ "lro:value:(off on auto)"
+ "lro-effective"
+ "mac-address:MAC address:"
+ "maxbw:bandwith:"
+ "pool:pools:"
+ "pool-effective"
+ "priority:priority:(high medium low)"
+ "rxringsavail"
+ "rxrings:value:"
+ "rxhwclntavail"
+ "txringsavail"
+ "txrings:value:"
+ "txhwclntavail"
+ "forward:value:(0 1)"
+ "stp_priority:value:"
+ "stp_cost:value:"
+ "stp_edge:value:(0 1)"
+ "stp_p2p:value:(true false auto)"
+ "stp_mcheck:value:(0 1)"
+ "protection:value:(mac-nospoof ip-nospoof dhcp-nospoof restricted)"
+ "vsi-mgrid:IPv6 address:"
+ "vsi-mgrid-effective"
+ "vsi-mgrid-enc:encoding:(oracle_v1 none)"
+ "vsi-mgrid-enc-effective"
+ "vsi-typeid:value:"
+ "vsi-typeid-effective"
+ "vsi-vers:value:"
+ "vsi-vers-effective"
+ "zone:value:_zones"
+ )
+ linkprops_nonvlanvnic=(
+ "default_tag:value:"
+ "learn_decay:value:"
+ "learn_limit:value:"
+ "rxfanout:value:"
+ "rxfanout-effective:value:"
+ "stp:value:(0 1)"
+ )
+ linkprops_wifi=(
+ "channel:value:"
+ "powermode:value:(off max fast)"
+ "radio:value:(on off)"
+ "speed:value:"
+ )
+ linkprops_ether=(
+ "duplex"
+ "state"
+ "adv_autoneg_cap"
+ "adv_10gfdx_cap"
+ "adv_1000fdx_cap"
+ "adv_1000hdx_cap"
+ "adv_100fdx_cap"
+ "adv_100hdx_cap"
+ "adv_10fdx_cap"
+ "adv_10hdx_cap"
+ "en_10gfdx_cap:value:(0 1)"
+ "en_1000fdx_cap:value:(0 1)"
+ "en_1000hdx_cap:value:(0 1)"
+ "en_100fdx_cap:value:(0 1)"
+ "en_100hdx_cap:value:(0 1)"
+ "en_10fdx_cap:value:(0 1)"
+ "en_10hdx_cap:value:(0 1)"
+ "flowctrl:value:(auto no rx tx pfc bi)"
+ "flowctrl-effective"
+ "gvrp-timeout:value:"
+ "mtu:value:"
+ "ntcs"
+ "pfcmap:value:"
+ "pfcmap-lcl-effective"
+ "pfcmap-rmt-effective"
+ "speed"
+ "tagmode:value:(normal vlanonly)"
+ "vlan-announce:value:(off gvrp)"
+ )
+ linkprops_ib=(
+ "linkmode:value:(cm ud)"
+ )
+ linkprops_iptun=(
+ "hoplimit:value:"
+ "encaplimit:value:"
+ )
+ linkprops=(
+ $linkprops_general $linkprops_wifi $linkprops_ether
+ $linkprops_ib $linkprops_iptun
+ )
+
case $service in
+ ("help")
+ _arguments ':subcommand:($subcmds)'
+ ;;
+
("show-link")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
- set1 \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $link_properties' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $link_properties' \
- set2 \
- '(-s --statistics)'{-s,--statistics}'[display link statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $link_stats_properties' \
- ':link name:_dladm_links' \
+ '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $link_stats_properties' \
+ ':link name:_dladm_links'
;;
("rename-link")
_arguments -A "-*" \
- '-R[root directory]:directory:_path_files -/' \
+ '-R[Root directory]:directory:_path_files -/' \
':old link name:_dladm_links' \
- ':new link name:' \
+ ':new link name:'
;;
("show-phys")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-s --statistics)'{-s,--statistics}'[display link statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" link media state speed duplex device' \
+ '-D[Show Data Center Bridging information]:featureset:(ets pfc)' \
+ '-H[Show hardware resource usage]' \
+ '-L[Display location information]' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '-m[Display MAC address information]' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
+ '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" link media state speed duplex device' \
':physical link name:_dladm_devs'
;;
@@ -146,97 +291,116 @@ _dladm() {
("create-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
- '(-P --policy)'{-P,--policy}'[port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mode)'{-m,--mode}'[Aggregation mode]:mode:(dlmp trunk)' \
+ '(-P --policy)'{-P,--policy}'[Port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
'(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
'(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
- '(-u --unicast)'{-u,--unicast}'[unicast address]:unicast address:' \
+ '(-u --unicast)'{-u,--unicast}'[Unicast address]:unicast address:' \
':aggregate link name:'
;;
("modify-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
- '(-P --policy)'{-P,--policy}'[port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mode)'{-m,--mode}'[Aggregation mode]:mode:(dlmp trunk)' \
+ '(-P --policy)'{-P,--policy}'[Port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
'(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
'(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
- '(-u --unicast)'{-u,--unicast}'[unicast address]:unicast address:' \
+ '(-u --unicast)'{-u,--unicast}'[Unicast address]:unicast address:' \
':aggregate link name:_dladm_aggrs'
;;
("delete-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':aggregate link name:_dladm_aggrs'
;;
("add-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
':aggregate link name:_dladm_aggrs'
;;
("remove-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_aggr_ports' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_aggr_ports' \
':aggregate link name:_dladm_aggrs'
;;
("show-aggr")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-s --statistics)'{-s,--statistics}'[display link statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':aggregate link name:_dladm_links' \
- set1 \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_properties' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_properties' \
- lacp \
'(-L --lacp)'{-L,--lacp}'[LACP information]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_lacp_properties' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_lacp_properties' \
- extended \
- '(-x --extended)'{-x,--extended}'[extended information]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_ext_properties' \
+ '(-x --extended)'{-x,--extended}'[Extended information]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_ext_properties'
;;
("create-vlan")
_arguments -A "-*" \
'(-t --temporary)'{-t,--temporary}'[VLAN should be temporary]' \
- '(-f --force)'{-f,--force}'[force VLAN creation]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
+ '(-f --force)'{-f,--force}'[Force VLAN creation]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
'-v[VLAN ID]:id:' \
':VLAN link name:'
;;
("delete-vlan")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':VLAN link name:_dladm_vlans'
;;
+ ("modify-vlan")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[VLAN should be temporary]' \
+ '(-f --force)'{-f,--force}'[Force VLAN creation]' \
+ '(-R --root-dir)'{-R,--root-dir}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '-v[VLAN ID]:id:' \
+ - set1 \
+ '-L[Source link]:link:_dladm_links' \
+ - set2 \
+ ':VLAN link name:'
+ ;;
+
("show-vlan")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $vlan_properties' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $vlan_properties' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':VLAN link name:_dladm_vlans'
;;
("scan-wifi")
_arguments -A "-*" \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $wifi_connect_properties' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $wifi_connect_properties' \
':wireless link name:_dladm_wifi_links'
;;
@@ -244,146 +408,312 @@ _dladm() {
_arguments -A "-*" \
'(-e --essid)'{-e,--essid}'[ESSID name]:network:_dladm_wifi_nets' \
'(-b --bsstype)'{-b,--bsstype}'[BSS type]:' \
- '(-m --mode)'{-m,--mode}'[802.11 mode]:mode:(a b g)' \
- '(-k --key)'{-k,--key}'[key name]:key:_dladm_secobjs' \
- '(-s --sec)'{-s,--sec}'[security mode]:(none wep wpa)' \
- '(-a --auth)'{-a,--auth}'[authentication mode]:mode:(open shared)' \
- '(-c --create-ibss)'{-c,--create-ibss}'[create an ad-hoc network]' \
- '(-T --timeout)'{-T,--timeout}'[association timeout]:(forever)' \
+ '(-m --mode)'{-m,--mode}'[802.11 mode]:802.11 mode:(a b g n)' \
+ '(-k --key)'{-k,--key}'[Key name]:key:_dladm_secobjs' \
+ '(-s --sec)'{-s,--sec}'[Security mode]:security mode:(none wep wpa)' \
+ '(-a --auth)'{-a,--auth}'[Authentication mode]:authentication mode:(open shared)' \
+ '(-c --create-ibss)'{-c,--create-ibss}'[Create an ad-hoc network]' \
+ '(-T --timeout)'{-T,--timeout}'[Association timeout]:association timeout:(forever)' \
':wireless link name:_dladm_wifi_links'
;;
("disconnect-wifi")
_arguments -A "-*" \
- set1 \
- '(-a --all-links)'{-a,--all-links}'[all links]' \
+ '(-a --all-links)'{-a,--all-links}'[All links]' \
- set2 \
':wireless link name:_dladm_wifi_links'
;;
("show-wifi")
_arguments -A "-*" \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $wifi_properties' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $wifi_properties' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':wireless link name:_dladm_wifi_links'
;;
("show-ether")
_arguments -A "-*" \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-x --extended)'{-x,--extended}'[extended output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $ether_properties' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-x --extended)'{-x,--extended}'[Extended output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $ether_properties' \
+ '-P[protocol]:protocol:(ecp vdp)' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':ethernet link name:_dladm_ethers'
;;
("set-linkprop")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[change should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --prop)'{-p,--prop}'[Properties]:property:_values -s , "property" ${(M)linkprops\:#*\:*}' \
':link name:_dladm_links'
;;
("reset-linkprop")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[change should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --prop)'{-p,--prop}'[Properties]:property:_values -s , "property" ${${(M)linkprops\:#*\:*}%%\:*}' \
':link name:_dladm_links'
;;
("show-linkprop")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link properties]' \
- '(-c --parseable)'{-c,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $linkprop_properties' \
- '(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link properties]' \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $linkprop_properties' \
+ '(-p --prop)'{-p,--prop}'[Properties]:property:_values -s , "property" ${linkprops%%\:*}' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':link name:_dladm_links'
;;
("create-secobj")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-c --class)'{-c,--class}'[class]:class:(wep wpa)' \
- '(-f --file)'{-f,--file}'[file containing object value]:file:_path_files' \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-c --class)'{-c,--class}'[Class]:class:(wep wpa)' \
+ '(-f --file)'{-f,--file}'[File containing object value]:file:_path_files' \
':object name:'
;;
("delete-secobj")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':object name:_dladm_secobjs'
;;
("show-secobj")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent object information]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $secobj_properties' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent object information]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $secobj_properties' \
':object name:_dladm_secobjs'
;;
("create-vnic")
# TODO: MAC address completion could be richer
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
- '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto)' \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto vrrp)' \
'-v[VLAN ID]:id:' \
- '(-p --prop)'{-p,--prop}'[property values]:value:' \
+ '(-p --prop)'{-p,--prop}'[Property values]:value:_values -s , "property" ${(M)linkprops_general\:#*\:*}' \
':VNIC name:'
;;
("delete-vnic")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':VNIC name:_dladm_vnics'
;;
+ ("modify-vnic")
+ # TODO: MAC address completion could be richer
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto vrrp)' \
+ '-v[VLAN ID]:id:' \
+ '(-p --prop)'{-p,--prop}'[Property values]:value:_values -s , "property" ${(M)linkprops_general\:#*\:*}' \
+ - set1 \
+ '-L[Source link]:link:_dladm_links' \
+ - set2 \
+ ':VNIC name:'
+ ;;
+
("show-vnic")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent object information]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $vnic_properties' \
- '(-l --link)'{-l,--link}'[limit to VNICs on link]:link:_dladm_links' \
- '(-s --statistics)'{-s,--statistics}'[display VNIC statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent object information]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $vnic_properties' \
+ '(-l --link)'{-l,--link}'[Limit to VNICs on link]:link:_dladm_links' \
+ '(-s --statistics)'{-s,--statistics}'[Display VNIC statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':VNIC name:_dladm_vnics'
;;
("create-etherstub")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':etherstub name:'
;;
("delete-etherstub")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':etherstub name:_dladm_etherstubs'
;;
("show-etherstub")
_arguments -A "-*" \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':etherstub name:_dladm_etherstubs'
;;
("show-usage")
_arguments -A "-*" \
- '(-f --file)'{-f,--file}'[read records from file]:_path_files' \
- '(-F --format)'{-f,--format}'[plotfile format]:(gnuplot)' \
- '(-p --plot)'{-p,--plot}'[write plot to file]:' \
- '(-e --start)'{-e,--start}'[start time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
- '(-s --stop)'{-s,--stop}'[stop time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
+ '(-f --file)'{-f,--file}'[Read records from file]:file:_path_files' \
+ '(-F --format)'{-F,--format}'[Plotfile format]:plotfile format:(gnuplot)' \
+ '(-p --plot)'{-p,--plot}'[Write plot to file]:' \
+ '(-e --start)'{-e,--start}'[Start time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
+ '(-s --stop)'{-s,--stop}'[Stop time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
':link name:_dladm_links'
;;
+ ("create-bridge")
+ _arguments -A "-*" \
+ '(-P --protect)'{-P,--protect}'[Specify a protection method]:protection method:(stp trill)' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --priority)'{-p,--priority}'[Specify the bridge priority]:value' \
+ '(-m --max-age)'{-m,--max-age}'[Specify the max age for config info]:value' \
+ '(-h --hello-time)'{-h,--hello-time}'[Specify the hello time]:value' \
+ '(-d --forward-delay)'{-d,--forward-delay}'[Specify the forward delay]:value' \
+ '(-f --force-protocol)'{-f,--force-protocol}'[Specify forced maximum supported protocol]:value' \
+ '*'{-l,--link}'[Specify link to add]:link:_dladm_links' \
+ ':bridge name:'
+ ;;
+
+
+ ("modify-bridge")
+ _arguments -A "-*" \
+ '(-P --protect)'{-P,--protect}'[Specify a protection method]:protection method:(stp trill)' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --priority)'{-p,--priority}'[Specify the bridge priority]:value' \
+ '(-m --max-age)'{-m,--max-age}'[Specify the max age for config info]:value' \
+ '(-h --hello-time)'{-h,--hello-time}'[Specify the hello time]:value' \
+ '(-d --forward-delay)'{-d,--forward-delay}'[Specify the forward delay]:value' \
+ '(-f --force-protocol)'{-f,--force-protocol}'[Specify forced maximum supported protocol]:value' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("delete-bridge")
+ _arguments -A "-*" \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("add-bridge"|"remove-bridge")
+ _arguments -A "-*" \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '*'{-l,--link}'[Specify link to add]:link:_dladm_links' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("show-bridge")
+ # XXX $bridge_stats_properties get added into -o completions for set1
+ # XXX $bridge_link_stats_properties get added into -o completions for set3
+ _arguments -A "-*" \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ - set1 \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_properties' \
+ - set2 \
+ '(-s --statistics)'{-s,--statistics}'[Display statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:seconds' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_stats_properties' \
+ - set3 \
+ '(-l --link)'{-l,--link}'[Display link status or statistics]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_link_properties' \
+ - set4 \
+ '(-s --statistics)'{-s,--statistics}'[Display statistics]' \
+ '(-l --link)'{-l,--link}'[Display link status or statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:seconds' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_link_stats_properties' \
+ - set5 \
+ '(-f --forwarding)'{-f,--forwarding}'[Display forwarding entries]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_fwd_properties' \
+ - set6 \
+ '(-t --trill)'{-t,--trill}'[Display TRILL nickname entries]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_trill_properties' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("create-iptun")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary tunnel]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-T --type)'{-T,--type}'[Tunnel type]:tunnel type:(ipv4 ipv6 6to4)' \
+ '(-a --address)'{-a,--address}'[Endpoint addresses]:address/host:_values -s , "address/host" $tunnel_values' \
+ ':tunnel name:'
+ ;;
+
+ ("modify-iptun")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary modification]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-a --address)'{-a,--address}'[Endpoint addresses]:address/host:_values -s , "address/host" $tunnel_values' \
+ ':tunnel name:_dladm_iptuns'
+ ;;
+
+ ("delete-iptun")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary deletion]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ ':tunnel name:_dladm_iptuns'
+ ;;
+
+ ("show-iptun")
+ _arguments -A "-*" \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent tunnel configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $iptun_properties' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
+ ':tunnel name:_dladm_iptuns'
+ ;;
+
+ ("create-part")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary partition]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-f --force)'{-f,--force}'[Force partition creation]' \
+ '(-l --link)'{-l,--link}'[IP-over-IB physical link name]:IB link:_dladm_iblinks' \
+ '(-p --prop)'{-p,--prop}'[Set link properties]:link property:_values -s , "property" ${(M)linkprops_nonvlanvnic\:#*\:*} ${(M)linkprops_general\:#*\:*}' \
+ '(-P --pkey)'{-P,--pkey}'[Set parition key]:hex number:' \
+ ':partition link name:'
+ ;;
+
+ ("delete-part")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary deletion]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ ':link name:_dladm_parts'
+ ;;
+
+ ("show-part")
+ _arguments -A "-*" \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent partition configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-l --link)'{-l,--link}'[Information for this link]:link name:_dladm_iblinks' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $part_properties' \
+ ':partition link name:_dladm_parts'
+ ;;
+
+ ("show-ib")
+ _arguments -A "-*" \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent partition configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $ib_properties' \
+ ':IB link name:_dladm_iblinks'
+ ;;
+
(*)
_message "unknown dladm subcommand: $service"
;;
diff --git a/Completion/Solaris/Command/_dtrace b/Completion/Solaris/Command/_dtrace
new file mode 100644
index 000000000..a095589eb
--- /dev/null
+++ b/Completion/Solaris/Command/_dtrace
@@ -0,0 +1,41 @@
+#compdef dtrace
+# Synced with Nevada build 160 man pages
+
+_dtrace() {
+ _arguments -s \
+ '-32[generate 32-bit D programs and ELF files]' \
+ '-64[generate 64-bit D programs and ELF files]' \
+ '-a[claim anonymous tracing state]' \
+ '-A[generate driver.conf(4) directives for anonymous tracing]' \
+ '-b[set trace buffer size]' \
+ '-c[run specified command and exit upon its completion]' \
+ '-C[run cpp(1) preprocessor on script files]' \
+ '-D[define symbol when invoking preprocessor]' \
+ '-e[exit after compiling request but prior to enabling probes]' \
+ '-f[enable or list probes matching the specified function name]:function: ' \
+ '-F[coalesce trace output by function]' \
+ '-G[generate an ELF file containing embedded dtrace program]' \
+ '-H[print included files when invoking preprocessor]' \
+ '-h[Generate a header file]' \
+ '-i[enable or list probes matching the specified probe id]' \
+ '-I[add include directory to preprocessor search path]:include dir:_files -/' \
+ '-L[Add directory to search path for DTrace libraries]:lib dir:_files -/' \
+ '-l[list probes matching specified criteria]' \
+ '-m[enable or list probes matching the specified module name]:module: ' \
+ '-n[enable or list probes matching the specified probe name]:name: ' \
+ '-o[set output file]:output file:_files' \
+ '-p[grab specified process-ID and cache its symbol tables]:pid:_pids' \
+ '-P[enable or list probes matching the specified provider name]:provider: ' \
+ '-q[set quiet mode (only output explicitly traced data)]' \
+ '-s[enable or list probes according to the specified D script]' \
+ '-S[print D compiler intermediate code]' \
+ '-U[undefine symbol when invoking preprocessor]' \
+ '-v[set verbose mode (report program stability attributes)]' \
+ '-V[report DTrace API version]' \
+ '-w[permit destructive actions]' \
+ '-x[enable or modify compiler and tracing options]' \
+ '-X[specify ISO C conformance settings for preprocessor]:ISO C conformance:((a\:"ISO plus K&R extensions (default)" c\:"Strictly conformant ISO C" s\:"K&R C only" t\:"ISO plus K&R extensions"))' \
+ '-Z[permit probe descriptions that match zero probes]'
+}
+
+_dtrace "$@"
diff --git a/Completion/Solaris/Command/_flowadm b/Completion/Solaris/Command/_flowadm
new file mode 100644
index 000000000..53a9f2210
--- /dev/null
+++ b/Completion/Solaris/Command/_flowadm
@@ -0,0 +1,115 @@
+#compdef flowadm
+# Synced with the S11U1 build 19 man page
+
+_flowadm() {
+
+local -a subcmds tr props
+local expl
+
+_flowadm_flow(){
+ compadd "$@" - $(flowadm show-flow -p -o flow)
+}
+
+_flowadm_flow_int(){
+ compadd "$@" - $(flowadm show-flow -p -o flow)
+ compadd "$@" - $(dladm show-phys -p -o device)
+}
+
+subcmds=(
+ "help"
+ "show-flow"
+ "add-flow"
+ "remove-flow"
+ "set-flowprop"
+ "reset-flowprop"
+ "show-flowprop"
+)
+
+tr=(
+ "tcp"
+ "udp"
+ "sctp"
+ "icmp"
+ "icmpv6"
+)
+
+props=(
+ "maxbw"
+)
+
+if [[ $service == "flowadm" ]]; then
+ _arguments -C -A "-*" \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "flowadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+fi
+case $service in
+
+ ("help")
+ _arguments ':subcommand:($subcmds)'
+ ;;
+
+ ("show-flow")
+ _arguments -A "-*" \
+ '-o[specify field to display]:field:(flow link ipaddr proto port dsfield)' \
+ '-p[parsable output]' \
+ '-P[persistent flow property information]' \
+ - set1 \
+ '-l[display information for link]:link or flow:_net_interfaces' \
+ - set2 \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("add-flow")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ '-l[specify link to which flow will be added]:link:_net_interfaces' \
+ '-a[specify attribute]:attribute:(local_ip= remote_ip= transport=$tr local_port= dsfield=)' \
+ '-p[set property value]:property:(maxbw=)' \
+ ;;
+
+ ("remove-flow")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ - set1 \
+ '-l[specify link from which flow will be deleted]:link:_net_interfaces' \
+ - set2 \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("set-flowprop")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ '-p[set property value]:property:(maxbw=)' \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("reset-flowprop")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ '-p[set property value]:property:(maxbw=)' \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("show-flowprop")
+ _arguments -A "-*" \
+ '-c[parsable output (requires -o)]' \
+ '-l[specify link whose properties will be shown]:link:_net_interfaces' \
+ '-P[persistent flow property information]' \
+ '-p[property to show]:property:_values -s , "property" $props' \
+ ':flow:_flowadm_flow' \
+ ;;
+
+esac
+}
+
+_flowadm "$@"
diff --git a/Completion/Solaris/Command/_fmadm b/Completion/Solaris/Command/_fmadm
new file mode 100644
index 000000000..56dac4f96
--- /dev/null
+++ b/Completion/Solaris/Command/_fmadm
@@ -0,0 +1,111 @@
+#compdef fmadm
+# Synced with the Nevada build 168 man page
+
+_fm_modules() {
+ compadd "$@" - $(fmadm config 2> /dev/null | awk 'NR == 1 {continue} {print $1}')
+}
+
+_fm_faulted_fmris() {
+ compadd "$@" - $(fmadm faulty -r 2> /dev/null | awk '{print $1}')
+}
+
+_fm_faulted_uuids() {
+ compadd "$@" - $(fmadm faulty -s 2> /dev/null | tail +4 | awk '{print $4}')
+}
+
+_fm_faulted_labels() {
+ local q='"'
+ compadd "$@" - $(fmadm faulty -f 2> /dev/null | while read line; do
+ if [[ $line == "----"* ]]; then
+ read line
+ if [[ $line == '"'* ]]; then
+ print ${${line[(r)$q,(rn:2:)$q]}[2,-2]}
+ fi
+ fi
+ done)
+}
+
+_fmadm() {
+ local context state line expl
+ local -A opt_args
+ local -a subcmds
+
+ # TODO: lookup-alias and remove-alias need completion based on the
+ # output of list-alias, but I have no examples of that output.
+
+ subcmds=(
+ "acquit" "config" "faulty" "flush" "load" "unload"
+ "repaired" "replaced" "reset" "rotate"
+ "add-alias" "remove-alias" "lookup-alias" "list-alias" "sync-alias"
+ )
+
+ if [[ $service == "fmadm" ]]; then
+ _arguments -C -A "-*" \
+ '-q[Quite mode]' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "fmadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ ("acquit")
+ _alternative \
+ "fmadm-acquit-label:label:_fm_faulted_labels" \
+ "fmadm-acquit-uuid:uuid:_fm_faulted_uuids" \
+ "fmadm-acquit-fmri:fmri:_fm_faulted_fmris"
+ ;;
+
+ ("config")
+ ;;
+
+ ("faulty")
+ _arguments -A "-*" \
+ '-a[Display all faults]' \
+ '-f[Display faulty FRUs]' \
+ '-g[Group faults]' \
+ '-i[Display persistent cache IDs]' \
+ '-n[Limit output to n entries]:number:' \
+ '-p[Page output]' \
+ '-r[Display resources]' \
+ '-s[Display one-line summaries]' \
+ '-u[Only display fault with given uuid]:uuid:_fm_faulted_uuids' \
+ '-v[Display full output]'
+ ;;
+
+ ("flush")
+ _fm_faulted_fmris
+ ;;
+
+ ("load")
+ _path_files -g "/*"
+ ;;
+
+ ("unload")
+ _fm_modules
+ ;;
+
+ ("repaired"|"replaced")
+ _alternative \
+ "fmadm-acquit-label:label:_fm_faulted_labels" \
+ "fmadm-acquit-fmri:fmri:_fm_faulted_fmris"
+ ;;
+
+ ("reset")
+ _arguments -A "-*" \
+ '-s[Reset named SERD]:serd:' \
+ ':module:_fm_modules'
+ ;;
+
+ ("rotate")
+ _values "logfile" "errlog" "fltlog" "infolog" "infolog_hival"
+ ;;
+
+ esac
+}
+
+_fmadm "$@"
diff --git a/Completion/Solaris/Command/_ipadm b/Completion/Solaris/Command/_ipadm
new file mode 100644
index 000000000..34d1eacba
--- /dev/null
+++ b/Completion/Solaris/Command/_ipadm
@@ -0,0 +1,375 @@
+#compdef ipadm
+# Synced with the S11U1 build 19 man page
+
+_ipadm_ifs() {
+ local -a extra
+
+ zparseopts -D -E -a extra /+:
+
+ compadd "$@" - $(ipadm show-if -p -o ifname) $extra[2,-1]
+}
+
+_ipadm_enabled_ifs() {
+ # Interfaces not marked "disabled"
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o state,ifname)}:#disabled:*}#*:}"
+}
+
+_ipadm_disabled_ifs() {
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o state,ifname)}#disabled:*}:#*:*}"
+}
+
+_ipadm_vnis() {
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o class,ifname)}#vni:*}:#*:*}"
+}
+
+_ipadm_ipmps() {
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o class,ifname)}#ipmp:*}:#*:*}"
+}
+
+_ipadm_get_possible_values() {
+ local -a proto poss
+ local cmd
+
+ cmd=${${(M)words:#set-*}/set/show}
+ if [[ $cmd == "show-prop" ]]; then
+ # You have to specify a protocol for show-prop if you specify a
+ # property, so we loop through them all.
+ poss=()
+ for proto in ipv4 ipv6 icmp tcp udp sctp; do
+ poss=( $poss ${(u)=$(ipadm $cmd -c -p ${IPREFIX%=} -o possible $proto 2> /dev/null)//,/ } )
+ done
+ poss=( ${(u)poss:#\?} )
+ else
+ proto=${=opt_args[-m]:+-m $opt_args[-m]}
+ poss=( ${(u)=$(ipadm $cmd -c -p ${IPREFIX%=} $proto -o possible)//,/ } )
+ fi
+ if [[ $poss[1] == [0-9]##-[0-9]## ]]; then
+ if (( $#poss > 1 )); then
+ _message -e "number in ranges ${(j:, :)poss}"
+ else
+ _message -e "number in range $poss"
+ fi
+ elif [[ -z $poss[1] ]]; then
+ _message -e "value"
+ else
+ compadd "$@" - $poss
+ fi
+}
+
+_ipadm_addrobjs() {
+ compadd "$@" - $(ipadm show-addr -p -o addrobj)
+}
+
+_ipadm_addrobjs_or_ifs() {
+ compadd "$@" - $(ipadm show-addr -p -o addrobj) \
+ $(ipadm show-if -p -o ifname)
+}
+
+_ipadm_protos() {
+ compadd "$@" - $(ipadm show-prop -c -o proto)
+}
+
+_ipadm() {
+ local context state line expl
+ local -A opt_args
+ local -a subcmds
+ local -a if_properties if_propproperties if_properties2
+ local -a addr_properties addr_propproperties
+ local -a addrobj_properties
+ local -a proto_ipv4_properties proto_ipv6_properties proto_tcp_properties
+ local -a proto_udp_properties proto_sctp_properties proto_icmp_properties
+ local -a proto_all_properties proto_propproperties
+
+ subcmds=(
+ "help"
+ {"show","disable","enable"}"-if"
+ {"create","delete"}"-ip"
+ {"create","delete"}"-vni"
+ {"create","delete","add","remove"}"-ipmp"
+ {"set","reset","show"}"-ifprop"
+ {"create","delete","show","up","down","refresh","disable","enable"}"-addr"
+ {"set","reset","show"}"-addrprop"
+ {"set","reset","show"}"-prop"
+ )
+
+ if_properties=( "ifname" "class" "state" "active" "current" "persistent" "over" )
+
+ if_propproperties=( "ifname" "property" "proto" "perm" "current" "persistent" "default" "possible" )
+
+ if_properties2=(
+ "arp:value:_ipadm_get_possible_values"
+ "forwarding:value:_ipadm_get_possible_values"
+ "metric:value:_ipadm_get_possible_values"
+ "mtu:value:_ipadm_get_possible_values"
+ "nud:value:_ipadm_get_possible_values"
+ "usesrc:value:_ipadm_ifs -/ none"
+ "exchange_routes:value:_ipadm_get_possible_values"
+ "group:value:_ipadm_get_possible_values"
+ "standby:value:_ipadm_get_possible_values"
+ )
+
+ addr_properties=(
+ "broadcast:value:_ipadm_get_possible_values"
+ "deprecated:value:_ipadm_get_possible_values"
+ "prefixlen:value:_ipadm_get_possible_values"
+ "private:value:_ipadm_get_possible_values"
+ "reqhost:value:_ipadm_get_possible_values"
+ "transmit:value:_ipadm_get_possible_values"
+ "zone:value:_zones -t c"
+ )
+
+ addr_propproperties=( "addrobj" "property" "perm" "current" "persistent" "default" "possible" )
+
+ addrobj_properties=(
+ "addrobj" "type" "state" "current" "persistent" "addr"
+ "cid-type" "cid-value" "begin" "expire" "renew"
+ )
+
+ proto_ipv4_properties=( "hostmodel" "ttl" "forwarding" )
+ proto_ipv6_properties=( "hostmodel" "hoplimit" "forwarding" )
+ proto_tcp_properties=( "cong_default" "cong_enabled" "ecn" "extra_priv_ports" "max_buf" "recv_buf"
+ "send_buf" "sack" "smallest_anon_port" "largest_anon_port" "smallest_nonpriv_port" )
+ proto_udp_properties=( "extra_priv_ports" "max_buf" "recv_buf" "send_buf" "smallest_anon_port"
+ "largest_anon_port" "smallest_nonpriv_port" )
+ proto_sctp_properties=( "cong_default" "cong_enabled" "extra_priv_ports" "max_buf" "recv_buf"
+ "send_buf" "smallest_anon_port" "largest_anon_port" "smallest_nonpriv_port" )
+ proto_icmp_properties=( "max_buf" "recv_buf" "send_buf" )
+ proto_all_properties=( $proto_ipv4_properties $proto_ipv6_properties $proto_tcp_properties
+ $proto_udp_properties $proto_sctp_properties $proto_icmp_properties )
+ proto_all_properties=( $^proto_all_properties:value:_ipadm_get_possible_values )
+
+ proto_propproperties=( "proto" "property" "perm" "current" "persistent" "default" "possible" )
+
+ if [[ $service == "ipadm" ]]; then
+ _arguments -C -A "-*" \
+ '-\?[Help]' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "ipadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ ("help")
+ _arguments ':subcommand:($subcmds)'
+ ;;
+
+ ("create-ip")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ ':interface name:'
+ ;;
+
+ ("delete-ip")
+ _arguments -A "-*" \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("create-vni")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ ':VNI name:'
+ ;;
+
+ ("delete-vni")
+ _arguments -A "-*" \
+ ':VNI name:_ipadm_vnis'
+ ;;
+
+ ("create-ipmp")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ '(-i --interface)'{-i,--interface}'[List of underlying interfaces]:interface name:_values -s , "interface" $(ipadm show-if -p -o ifname)' \
+ ':IPMP interface name:'
+ ;;
+
+ ("delete-ipmp")
+ _arguments -A "-*" \
+ '(-f --force)'{-f,--force}'[First remove all underlying interfaces from group]' \
+ ':IPMP interface name:_ipadm_ipmps'
+ ;;
+
+ ("add-ipmp")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ '(-i --interface)'{-i,--interface}'[List of underlying interfaces]:interface name:_values -s , "interface" $(ipadm show-if -p -o ifname)' \
+ ':IPMP interface name:_ipadm_ipmps'
+ ;;
+
+ ("remove-ipmp")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ '(-i --interface)'{-i,--interface}'[List of underlying interfaces]:interface name:_values -s , "interface" $(ipadm show-if -p -o ifname)' \
+ ':IPMP interface name:_ipadm_ipmps'
+ ;;
+
+ ("show-if")
+ _arguments -A "-*" \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $if_properties' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("disable-if")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ ':interface name:_ipadm_enabled_ifs'
+ ;;
+
+ ("enable-if")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ ':interface name:_ipadm_disabled_ifs'
+ ;;
+
+ ("set-ifprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-m --module)'{-m,--module}'[Protocol]:protocol:(ipv4 ipv6)' \
+ '(-p --prop)'{-p,--prop}'[Property to set]:property:_values -s , "property" $if_properties2' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("reset-ifprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-m --module)'{-m,--module}'[Protocol]:protocol:(ipv4 ipv6)' \
+ '(-p --prop)'{-p,--prop}'[Property to reset]:property:($if_properties2)' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("show-ifprop")
+ _arguments -A "-*" \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-m --module)'{-m,--module}'[Protocol]:protocol:(ipv4 ipv6)' \
+ '(-o --output)'{-o,--output}'[Property properties to display]:property:_values -s , "property" $if_propproperties' \
+ '(-p --prop)'{-p,--prop}'[Interface properties to display]:property:_values -s , "property" ${if_properties2%%\:*}' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("create-addr")
+ # This causes all options and arguments following -T to be
+ # stuck into $opt_args[-T]. It feels hacky, but it seems
+ # to do the trick.
+ # XXX When -T is static, it's not necessary.
+ _arguments -C -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Address should be temporary]' \
+ '-T[Address type]:*::address type:->newaddr'
+
+ if [[ $state == "newaddr" ]]; then
+
+ case ${opt_args[-T]#-T:} in
+ ("static:"*)
+ local -a addrthingsv4
+ addrthingsv4=( "local:address: " "remote:address: ")
+ _arguments -A "-*" \
+ '(-d --down)'{-d,--down}'[Address should be marked down]' \
+ '(-a --address)'{-a,--address}'[Address specification]:address:_values -s , "address" $addrthingsv4' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ("dhcp:"*)
+ _arguments -A "-*" \
+ '(-w --wait)'{-w,--wait}'[Seconds to wait for completion]:number or "forever":{if [[ -prefix [0-9]## ]]; then _message -e "number of seconds"; else _wanted forever expl "number or \"forever\"" compadd forever; fi}' \
+ '-h[Request a specific hostname]:hostname:' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ("addrconf:"*)
+ local -a addrthingsv6 statefulness
+ addrthingsv6=( "local:interface id: " "remote:interface id: ")
+ statefulness=( "stateful:statefulness:(yes no)" "stateless:statelessness:(yes no)" )
+ _arguments -A "-*" \
+ '(-i --interface-id)'{-i,--interface-id}'[Interface ID]:address:_values -s , "interface id" $addrthingsv6' \
+ '(-p --prop)'{-p,--prop}'[Statefulness configuration]:statefulness configuration:_values -s , "statefulness" $statefulness' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+ (*)
+ _wanted commands expl "address type" compadd static dhcp addrconf
+ ;;
+ esac
+ fi
+
+ ;;
+
+ ("delete-addr")
+ _arguments -A "-*" \
+ '(-r --release)'{-r,--release}'[Release DHCP-acquired address]' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("show-addr")
+ _arguments -A "-*" \
+ '(-d --dhcp -p --parseable)'{-d,--dhcp}'[Display DHCP status fields]' \
+ '(-p --parseable -d --dhcp)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $addrobj_properties' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ({"up","down","disable","enable"}"-addr")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("refresh-addr")
+ _arguments -A "-*" \
+ '(-i --inform)'{-i,--inform}'[Retrieve DHCP parameters]' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("set-addrprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to set]:property:_values -s , "property" $addr_properties' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("reset-addrprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to reset]:property:(${addr_properties%%\:*})' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("show-addrprop")
+ _arguments -A "-*" \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Property properties to display]:property:_values -s , "property" $addr_propproperties' \
+ '(-p --prop)'{-p,--prop}'[Address object properties to display]:property:_values -s , "property" ${addr_properties%%\:*}' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ("set-prop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to set]:property:_values -s , "property" $proto_all_properties' \
+ ':protocol name:_ipadm_protos'
+ ;;
+
+ ("reset-prop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to reset]:property:(${proto_all_properties%%\:*})' \
+ ':protocol name:_ipadm_protos'
+ ;;
+
+ ("show-prop")
+ _arguments -A "-*" \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Property properties to display]:property:_values -s , "property" $proto_propproperties' \
+ '(-p --prop)'{-p,--prop}'[Protocol properties to display]:property:_values -s , "property" ${proto_all_properties%%\:*}' \
+ ':protocol name:_ipadm_protos'
+ ;;
+
+ (*)
+ _message "unknown ipadm subcommand: $service"
+ ;;
+ esac
+}
+
+_ipadm "$@"
diff --git a/Completion/Solaris/Command/_netstat b/Completion/Solaris/Command/_netstat
new file mode 100644
index 000000000..bf8e5aaa4
--- /dev/null
+++ b/Completion/Solaris/Command/_netstat
@@ -0,0 +1,61 @@
+#compdef netstat
+
+_netstat() {
+ local -a f_rules
+
+ f_rules=(
+ 'af\::specify address family: inet, inet6, unix, number'
+ 'outif\::specify output interface: ifName, ifIndex, any, none'
+ 'dst\::specify destination IP: ip-addr[/mask], any, none'
+ 'flags\::select routes tagged with flags: [+ -]?[ABDGHLMSU]+'
+ )
+
+ _arguments \
+ - set1 \
+ '-a[show state of all sockets, all routing tables or all interfaces]' \
+ '-R[show extended security attributes for sockets and routing tables]' \
+ '-n[do not resolve addresses to names]' \
+ '-v[verbose]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' \
+ - set2 \
+ '-r[show routing table]' \
+ '-f[filter routing table]:rule:(($f_rules))' \
+ '-a[show state of all sockets, all routing tables or all interfaces]' \
+ '-v[verbose]' \
+ '-n[do not resolve addresses to names]' \
+ '-R[show extended security attributes for sockets and routing tables]' \
+ - set3 \
+ '-g[show multicast group memberships]' \
+ '-n[do not resolve addresses to names]' \
+ '-v[verbose]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ - set4 \
+ '-i[show state of interfaces]' \
+ '-a[show state of all sockets, all routing tables or all interfaces]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-n[do not resolve addresses to names]' \
+ '-I[select interface]:interface:_net_interfaces' \
+ - set5 \
+ '-m[show STREAMS memory statistics]' \
+ '-v[verbose]' \
+ - set6 \
+ '-p[show net to media tables]' \
+ '-n[do not resolve addresses to names]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ - set7 \
+ '-s[show per protocol statistics]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' \
+ - set8 \
+ '-M[show multicast routing tables]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-n[do not resolve addresses to names]' \
+ '-s[show per protocol statistics]' \
+ - set9 \
+ '-D[show status of DHCP configured interfaces]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-I[select interface]:interface:_net_interfaces' \
+}
+
+_netstat "$@"
diff --git a/Completion/Solaris/Command/_pkg5 b/Completion/Solaris/Command/_pkg5
new file mode 100644
index 000000000..bcd4e3daf
--- /dev/null
+++ b/Completion/Solaris/Command/_pkg5
@@ -0,0 +1,431 @@
+#compdef pkg
+
+_pkg5_pkgs() {
+ local cache_policy cache_id=pkg5_installed_pkgs:$HOST:${pkg5_root//\//+}
+ typeset -a -g _pkg5_installed_pkgs
+
+ zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
+ if [[ -z "$cache_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _pkg5_installed_caching_policy
+ fi
+
+ if ( [[ $#_pkg5_installed_pkgs -eq 0 ]] || _cache_invalid $cache_id ) && ! _retrieve_cache $cache_id; then
+ _pkg5_installed_pkgs=( $(
+ pkg -R $pkg5_root list -H | while read pkg junk; do
+ pkga=( ${(s:/:)pkg} )
+ for i in {1..$#pkga}; do
+ print ${(j:/:)${pkga[$i,-1]}}
+ done
+ done) )
+ _store_cache $cache_id _pkg5_installed_pkgs
+ fi
+
+ compadd "$@" - ${_pkg5_installed_pkgs}
+}
+
+_pkg5_pkgs_a() {
+ local cache_policy cache_id=pkg5_known_pkgs:$HOST:${pkg5_root//\//+}
+ typeset -a -g _pkg5_known_pkgs
+
+ zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
+ if [[ -z "$cache_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _pkg5_known_caching_policy
+ fi
+
+ if ( [[ $#_pkg5_known_pkgs -eq 0 ]] || _cache_invalid $cache_id ) && ! _retrieve_cache $cache_id; then
+ _pkg5_known_pkgs=( $(
+ pkg -R $pkg5_root list -aH --no-refresh | while read pkg junk; do
+ pkga=( ${(s:/:)pkg} )
+ for i in {1..$#pkga}; do
+ print ${(j:/:)${pkga[$i,-1]}}
+ done
+ done) )
+ _store_cache $cache_id _pkg5_known_pkgs
+ fi
+
+ compadd "$@" - ${_pkg5_known_pkgs}
+}
+
+_pkg5_avoided_pkgs() {
+ compadd "$@" - $(pkg -R $pkg5_root unavoid)
+}
+
+_pkg5_pubs() {
+ compadd "$@" - $(pkg -R $pkg5_root publisher -H | awk '{print $1}')
+}
+
+_pkg5_variants() {
+ compadd "$@" - $(pkg -R $pkg5_root variant -H | awk '{print $1}')
+}
+
+_pkg5_facets() {
+ compadd "$@" - $(pkg -R $pkg5_root facet -H | awk '{print $1}')
+}
+
+_pkg5_known_caching_policy() {
+ [[ $pkg5_root/var/pkg/state/known/catalog.attrs -nt "$1" ]]
+}
+
+_pkg5_installed_caching_policy() {
+ [[ $pkg5_root/var/pkg/state/installed/catalog.attrs -nt "$1" ]]
+}
+
+_pkg5() {
+ local expl context state line pkg5_root prop
+ typeset -A opt_args
+ local -a subcmds pkg5_actions pkg5_cattr pkg5_sattr be_opts
+ local -a publisher_properties image_properties certs
+
+ subcmds=(
+ install uninstall list update refresh version help
+ info search verify fix revert contents image-create
+ {change-,}{variant,facet} avoid unavoid history
+ {{un,}set-,}property {add,remove}-property-value
+ {{un,}set-,}publisher purge-history rebuild-index
+ update-format freeze unfreeze {{un,}set-,}mediator
+ )
+
+ pkg5_actions=(
+ set depend dir driver file group hardlink legacy license link
+ signature unknown user
+ )
+
+ # Pseudo attributes for the contents subcommand
+ pkg5_cattr=(
+ action.hash action.key action.name action.raw
+ pkg.fmri pkg.name pkg.publisher pkg.shortfmri
+ )
+
+ # Pseudo attributes for the search subcommand
+ pkg5_sattr=(
+ $pkg5_cattr search.match search.match_type
+ )
+
+ publisher_properties=(
+ "signature-policy:value:(ignore verify require-signatures require-names)"
+ "signature-required-names:value:"
+ )
+
+ image_properties=(
+ "be-policy:value:(default always-new create-backup when-required)"
+ "ca-path:value:_path_files -/"
+ "check-certificate-revocation:value:(true false)"
+ "flush-content-cache-on-success:value:(true false)"
+ "mirror-discovery:value:(true false)"
+ "send-uuid:value:(true false)"
+ "signature-policy:value:(ignore verify require-signatures require-names)"
+ "signature-required-names:value:"
+ "trust-anchor-directory:value:_path_files -/"
+ "use-system-repo:value:(true false)"
+ )
+
+ if [[ $service == "pkg" ]]; then
+ _arguments -C -A "-*" \
+ '(-\? --help)'{-\?,--help}'[Help]' \
+ '-R[Root directory]:directory:_path_files -/' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "pkg subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ pkg5_root=${${${opt_args[-R]}:-$PKG_IMAGE}:-/}
+
+ certs=( $(pkg -R $pkg5_root property -H ca-path | awk '{print $2}')/* )
+
+ # Options common to subcommands which might have to deal with BEs.
+ # Note that --backup-be-name needs to precede --be-name in order to
+ # ensure that completion sees "--b" as being ambiguous.
+ be_opts=(
+ "(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]"
+ "(--deny-new-be)--require-new-be[Force a new BE to be created]"
+ "--backup-be-name[Specify the name for the backup BE]:BE name: "
+ "--be-name[Specify a BE name]:BE name: "
+ "--no-be-activate[Don't activate the new BE]"
+ "(--require-backup-be)--no-backup-be[Don't leave behind a backup BE]"
+ "(--no-backup-be)--require-backup-be[Force leaving behind a backup BE]"
+ )
+
+ case $service in
+ ("install")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ "--accept[Accept all licenses]" \
+ "--licenses[Display all licenses]" \
+ "--reject[Specify an FMRI to exclude from the result]:fmri:_pkg5_pkgs" \
+ "--no-refresh[Don't refresh catalogs]" \
+ "--no-index[Don't reindex search database]" \
+ $be_opts \
+ '*:package:_pkg5_pkgs_a'
+ ;;
+
+ ("uninstall")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ $be_opts \
+ "--no-index[Don't reindex search database]" \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("update")
+ _arguments -A "-*" \
+ "-f[Don't check for pkg(5) updates]" \
+ '-n[Dry run]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ "--accept[Accept all licenses]" \
+ "--licenses[Display all licenses]" \
+ $be_opts \
+ "--reject[Specify an FMRI to exclude from the result]:fmri:_pkg5_pkgs" \
+ "--no-refresh[Don't refresh catalogs]" \
+ "--no-index[Don't reindex search database]" \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("list")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-a[Show not-installed packages]' \
+ '-f[Show all versions]' \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ '-n[Show newest versions]' \
+ '-s[Show summaries]' \
+ '-u[Show upgradable versions]' \
+ '-v[Show verbose pkg: FMRIs]' \
+ "--no-refresh[Don't refresh catalogs]" \
+ '*:package:_pkg5_pkgs_a'
+ ;;
+
+ ("refresh")
+ _arguments -A "-*" \
+ "--full[Full refresh]" \
+ '*:publisher:_pkg5_pubs'
+ ;;
+
+ ("info")
+ _arguments -A "-*" \
+ '--license[Display license text(s)]' \
+ '(-r)-l[Installed package]' \
+ '(-l)-r[Uninstalled package; fetch info from depot]:*:package:_pkg5_pkgs_a' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("search")
+ _arguments -A "-*" \
+ "(-p)-a[Show matching actions]" \
+ '-l[Local search]' \
+ '(-a)-p[Show packages]' \
+ '-r[Remote search]' \
+ '-H[Omit headers]' \
+ '-I[Case sensitive search]' \
+ '-s[Depot URI]' \
+ '*-o[Attribute output]:attributes:_values -s , "attribute" $pkg5_sattr' \
+ ':query:'
+ ;;
+
+ ("verify")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("fix")
+ _arguments -A "-*" \
+ '--accept[Accept all licenses]' \
+ '--licenses[Display all licenses]' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("revert")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-v[Verbose]' \
+ '--tagged[Revert all tagged files]:tag:' \
+ $be_opts \
+ "--no-refresh[Don't refresh catalogs]" \
+ "--no-index[Don't reindex search database]" \
+ '*:file:_path_files'
+ ;;
+
+ ("contents")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-m[Print raw manifests]' \
+ '*-a[Attribute matching]:attribute=pattern:' \
+ '*-o[Attribute output]:attributes:_values -s , "attribute" $pkg5_cattr' \
+ '*-s[Sort key]:attribute:' \
+ '*-t[Action type]:action:_values -s , "action" $pkg5_actions' \
+ '-r[Fetch manifests from depot]:*:package:_pkg5_pkgs_a' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("image-create")
+ _arguments -A "-*" \
+ '(-f --force)'{-f,--force}'[Force image creation]' \
+ '(-F --full -P --partial -U --user)'{-F,--full}'[Full image]' \
+ '(-F --full -P --partial -U --user)'{-P,--partial}'[Partial image]' \
+ '(-F --full -P --partial -U --user)'{-U,--user}'[User image]' \
+ '(-z --zone)'{-z,--zone}'[Zoned image]' \
+ '-k[Path to SSL key]:file:_path_files' \
+ '-c[Path to SSL cert]:file:_path_files' \
+ "--no-refresh[Don't refresh catalogs]" \
+ "*--variant[Specify image variants]:variant=instance:" \
+ "*--facet[Specify image facets]:facet=True/False:" \
+ '(-p --publisher)'{-p,--publisher}'[Specify publisher]:prefix=URI:' \
+ ':directory:_path_files -/'
+ ;;
+
+ ("change-variant")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet'] \
+ '-v[Verbose'] \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ '--accept[Accept all licenses]' \
+ '--licenses[Display all licenses]' \
+ $be_opts \
+ "*:variant:_values -s , 'variant' $(pkg -R $pkg5_root variant -H | awk '{print $1}')" \
+ ;;
+
+ ("change-facet")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet'] \
+ '-v[Verbose'] \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ '--accept[Accept all licenses]' \
+ '--licenses[Display all licenses]' \
+ $be_opts \
+ "*:facet:_values -s , 'facet' $(pkg -R $pkg5_root facet -H | awk '{print $1}')" \
+ ;;
+
+ ("variant")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '*:variant:_pkg5_variants'
+ ;;
+
+ ("facet")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '*:facet:_pkg5_facets'
+ ;;
+
+ ("avoid")
+ _arguments -A "-*" \
+ '*:package:_pkg5_pkgs_a'
+ ;;
+
+ ("unavoid")
+ _arguments -A "-*" \
+ '*:package:_pkg5_avoided_pkgs'
+ ;;
+
+ ("set-property")
+ _arguments -A "-*" \
+ ':property:_values "property" $image_properties' \
+ ':value:'
+ ;;
+
+ ("add-property-value")
+ _arguments -A "-*" \
+ ':property:_values "property" $image_properties' \
+ ':value:'
+ ;;
+
+ ("remove-property-value")
+ _arguments -A "-*" \
+ ':property:(${image_properties%%\:*})' \
+ ':value:'
+ ;;
+
+ ("unset-property")
+ _arguments -A "-*" \
+ '*:property:(${image_properties%%\:*})'
+ ;;
+
+ ("property")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '*:property:(${image_properties%%\:*})'
+ ;;
+
+ ("set-publisher")
+ _arguments -A "-*" \
+ '-P[Make preferred]' \
+ '(-e --enable)'{-e,--enable}'[Enable publisher]' \
+ '(-d --disable)'{-d,--disable}'[Disable publisher]' \
+ '(-g --add-origin)'{-g,--add-origin}'[Add origin URI]:uri:' \
+ '(-G --remove-origin)'{-G,--remove-origin}'[Remove origin URI]:uri:' \
+ '(-m --add-mirror)'{-m,--add-mirror}'[Add mirror URI]:uri:' \
+ '(-M --remove-mirror)'{-M,--remove-mirror}'[Remove mirror URI]:uri:' \
+ '-p[Repository URI]:url:' \
+ "--no-refresh[Don't refresh catalogs]" \
+ '--reset-uuid[Reset the image UUID for this publisher]' \
+ '--sticky[Make this publisher sticky]' \
+ '--non-sticky[Make this publisher non-sticky]' \
+ '--search-after[Set publisher search-order]:publisher:_pkg5_pubs' \
+ '--search-before[Set publisher search-order]:publisher:_pkg5_pubs' \
+ '--approve-ca-cert[Add trusted CA certificate]:CA cert path:_path_files' \
+ '--revoke-ca-cert[Revoke CA certificate]:CA cert hash:(${${certs#/etc/openssl/certs/}%.0})' \
+ '--unset-ca-cert[Remove trusted CA certificate]:CA cert hash:' \
+ '--set-property[Set publisher property]:property:_values "property" $publisher_properties' \
+ '--unset-property[Remove publisher property]:property:(${publisher_properties%%\:*})' \
+ '--add-property-value[Add publisher property value]:property:_values "property" $publisher_properties' \
+ '--remove-property-value[Remove publisher property value]:property:(${publisher_properties%%\:*})' \
+ ':publisher:_pkg5_pubs'
+ ;;
+
+ ("unset-publisher")
+ _arguments -A "-*" \
+ '*:publisher:_pkg5_pubs'
+ ;;
+
+ ("publisher")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-P[Display only preferred publisher]' \
+ '-n[Display only enabled publishers]' \
+ '*:publisher:_pkg5_pubs'
+ ;;
+
+ ("history")
+ local -a hist_columns
+ hist_columns=(
+ "be" "be_uuid" "client" "client_ver" "command" "finish"
+ "id" "new_be" "new_be_uuid" "operation" "outcome"
+ "reason" "snapshot" "start" "time" "user"
+ )
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-l[Long history]' \
+ '-n[Last n records]:number:' \
+ '-o[Column]:number:_values -s , "column" $hist_columns' \
+ '-t[Time range]'
+ ;;
+
+ ("freeze"|"unfreeze")
+ ;;
+
+ ("mediator"|"set-mediator"|"unset-mediator")
+ ;;
+
+ (*)
+ _message "unknown pkg subcommand: $service" ;;
+
+ esac
+}
+
+_pkg5 "$@"
diff --git a/Completion/Solaris/Command/_prstat b/Completion/Solaris/Command/_prstat
new file mode 100644
index 000000000..963fad649
--- /dev/null
+++ b/Completion/Solaris/Command/_prstat
@@ -0,0 +1,45 @@
+#compdef prstat
+
+_prstat()
+{
+ d_opt=(
+ "u"\:"seconds past the epoch"
+ "d"\:"standard date format"
+ )
+
+ sort_key=(
+ "cpu"\:"process CPU usage (default)"
+ "pri"\:"process priority"
+ "rss"\:"resident set size"
+ "size"\:"size of process image"
+ "time"\:"process execution time"
+ )
+
+ _arguments -A "-*" \
+ '-a[information about processes and users]' \
+ '-c[new reports below previous reports instead of overprinting them]' \
+ '-C[processes or lwps that are bound to processor sets in the list]:processor set list:' \
+ '-d[specify the representation of time]:time representation:(($d_opt))' \
+ '-h[only processes or lwps whose home lgroup is in the list]:lgroup list:' \
+ '-H[information about home lgroup]' \
+ '-j[only processes or lwps whose project ID is in the given list]:project list:' \
+ '-J[information about processes and projects]' \
+ '-k[only processes or lwps whose task ID is in tasklist]:task list'\
+ '-L[statistics for each light-weight process (LWP)]' \
+ '-m[microstate process accounting information]' \
+ '-n[restrict number of output lines]:ntop,[nbottom]' \
+ '-p[only processes whose process ID is in the list]:PID list' \
+ '-P[only processes or lwps which have most recently executed on a CPU in the list]:CPU list' \
+ '-R[Put prstat in the real time scheduling class]' \
+ '-s[Sort key (descending)]:key:(($sort_key))' \
+ '-S[Sort key (ascending)]:key:(($sort_key))' \
+ '-t[total usage summary for each user]' \
+ '-T[information about processes and tasks]' \
+ '-u[only processes whose effective user ID is in the list]:UID:_users' \
+ '-U[only processes whose real user ID is in the list]:UID:_users' \
+ '-v[verbose process usage]' \
+ '-z[only processes or LWPs whose zone ID is in the list]:zone ID:' \
+ '-Z[information about processes and zones]'
+}
+
+_prstat "$@"
diff --git a/Completion/Solaris/Command/_ps b/Completion/Solaris/Command/_ps
new file mode 100644
index 000000000..5ae61832a
--- /dev/null
+++ b/Completion/Solaris/Command/_ps
@@ -0,0 +1,77 @@
+#compdef ps
+
+_ps()
+{
+ local -a o_opt
+
+o_opt=(
+ "user[user ID]"
+ "ruser[real user ID]"
+ "group[group ID]"
+ "rgroup[real group ID]"
+ "pid[process ID]"
+ "ppid[parent process ID]"
+ "pgid[process group ID]"
+ "pcpu[ratio of CPU time used recently to CPU time available]"
+ "vsz[total size of the process in virtual memory, in kilobytes]"
+ "nice[decimal value of the system scheduling priority of the process]"
+ "etime[elapsed time since the process was started]"
+ "time[cumulative CPU time of the process]"
+ "tty[name of the controlling terminal of the process]"
+ "comm[name of the command being executed]"
+ "args[command with all its arguments as a string]"
+ "f[flags associated with the process]"
+ "s[state of the process]"
+ "c[processor utilization for scheduling]"
+ "uid[effective user ID number]"
+ "ruid[real user ID number]"
+ "gid[effective group ID number]"
+ "rgid[real group ID numberu]"
+ "projid[project ID number]"
+ "project[project name]"
+ "zoneid[zone ID number]"
+ "zone[zone name]"
+ "sid[process ID of the session leader]"
+ "taskid[task ID of the process]"
+ "class[scheduling class]"
+ "pri[priority, higher number - higher priority]"
+ "opri[obsolete priority, lower number - higher priority]"
+ "lwp[lwd ID number]"
+ "nlwp[number of lwps in the process]"
+ "psr[number of the processor to which the process or lwp is bound]"
+ "pset[ID of the processor set to which the process or lwp is bound]"
+ "addr[memory address of the process]"
+ "osz[total size of the process in virtual memory, in pages]"
+ "wchan[address of an event for which the process is sleeping]"
+ "stime[starting time or date of the process]"
+ "rss[resident set size of the process, in kilobytes]"
+ "pmem[ratio of resident set size to physical memory on the machine, in %]"
+ "fname[first 8 bytes of base name of process's executable file]"
+ "ctid[contract ID number]"
+ "lgrp[home lgroup]"
+)
+_arguments \
+ '-a[information about all processes most frequently requested]' \
+ '-c[information in a format that reflects scheduler properties]' \
+ '-d[information about all processes except session leaders]' \
+ '-e[information about every process]' \
+ '-f[full listing]' \
+ '-g[only process data whose group leaders ID number(s) appears in grplist]:group leader ID list' \
+ '-G[information for processes whose real group ID numbers are in gidlist]:real group ID list' \
+ '-H[prints the home lgroup of the process]' \
+ '-j[prints session ID and process group ID]' \
+ '-l[long listing]' \
+ '-L[information about each light weight process]' \
+ '-o[specify output format]:property:_values -s , "property" $o_opt' \
+ '-p[only process data whose process ID numbers are given in proclist]:process ID list' \
+ '-P[Prints the number of the processor to which the process or lwp is bound]' \
+ '-s[information on all session leaders whose IDs appear in sidlist]:session leader ID list' \
+ '-t[lists only process data associated with term]:term' \
+ '-u[only process data whose effective user ID number or login name is given in uidlist]:UID:_users' \
+ '-U[information for processes whose real user ID numbers or login names are in uidlist]:UID:_users' \
+ '-y[both RSS and SZ is reported in kilobytes, instead pages (used with -l)]' \
+ '-z[lists only processes in the specified zones]:zone list' \
+ '-Z[prints the name of the zone with which the process is associated]'
+}
+
+_ps "$@"
diff --git a/Completion/Solaris/Command/_snoop b/Completion/Solaris/Command/_snoop
new file mode 100644
index 000000000..f734c2fb1
--- /dev/null
+++ b/Completion/Solaris/Command/_snoop
@@ -0,0 +1,87 @@
+#compdef snoop
+
+_snoop() {
+ local -a t_opt exp
+
+t_opt=(
+ "r"\:"time relative to first packet"
+ "a"\:"absolute time"
+ "d"\:"delta time - time since receiving previous packet"
+)
+
+exp=(
+ "ether"
+ "ethertype"
+ "host"
+ "from"
+ "to"
+ "ip"
+ "ip6"
+ "arp"
+ "rarp"
+ "pppoe"
+ "pppoed"
+ "pppoes"
+ "vlan"
+ "vlan-id"
+ "broadcast"
+ "multicast"
+ "bootp"
+ "dhcp"
+ "dhcp6"
+ "apple"
+ "decnet"
+ "greater"
+ "less"
+ "udp"
+ "tcp"
+ "icmp"
+ "icmp6"
+ "ah"
+ "esp"
+ "net"
+ "port"
+ "rpc"
+ "zone"
+ "ldap"
+ "gateway"
+ "nofrag"
+ ">"
+ ">="
+ "<"
+ "<="
+ "="
+ "!="
+ "and"
+ "or"
+ "not"
+ "slp"
+ "sctp"
+ "ospf"
+)
+
+ _arguments \
+ '-a[generate audio signal on receiving packets]' \
+ '-c[quit after capturing maxcount packets]:maxcount' \
+ '-d[capture packets from specified device]:device:_net_interfaces' \
+ '-i[display packets previously captured to file]:file:_files' \
+ '-n[use file as IP address-to-name mapping table]:file:_files' \
+ '-o[save captured packets to file]:file:_files' \
+ '-p[display one or more packets from captured file]:first packet number [ , last packet number]' \
+ '-q[do not display packet counter when capturing to file]' \
+ '-r[do not resolve IP addresses to names]' \
+ '-s[truncate each packet after snaplen bytes]:snaplen' \
+ '-t[time-stamp presentation]:time-stamp mode:(($t_opt))' \
+ '-C[list code generated from filter expression]' \
+ '-D[display number of packets dropped on the summary line]' \
+ '-N[create IP-address-to-name mapping table file (used with -i)]' \
+ '-I[capture packets from specified interface]:interface:_net_interfaces' \
+ '-P[capture packets in non-promiscuous mode]' \
+ '-S[display size of the entire link layer frame in bytes]' \
+ '-V[verbose summary mode]' \
+ '-v[verbose mode]' \
+ '-x[display offset and length of packet in HEX and ASCII]:offset [ , length]' \
+ '*:expression:(($exp))' \
+}
+
+_snoop "$@"
diff --git a/Completion/Solaris/Command/_svcadm b/Completion/Solaris/Command/_svcadm
index 8cd001f29..f24675b41 100644
--- a/Completion/Solaris/Command/_svcadm
+++ b/Completion/Solaris/Command/_svcadm
@@ -4,11 +4,11 @@ _svcadm() {
local context state line subcmds
typeset -A opt_args
- subcmds=( enable disable restart refresh mark clear milestone )
+ subcmds=( enable disable restart refresh mark delegate clear milestone )
if [[ $service == "svcadm" ]]; then
_arguments -C -A "-*" \
- '-v[print actions verbosely]' \
+ '-v[Print actions verbosely]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -21,24 +21,24 @@ _svcadm() {
case $service in
(enable)
- _arguments \
- '-r[recursively enable dependencies]' \
- '-s[wait for service to come online]' \
- '-t[state change is temporary]' \
+ _arguments -A "-*" \
+ '-r[Recursively enable dependencies]' \
+ '-s[Wait for service to come online]' \
+ '-t[State change is temporary]' \
'*:instance FMRI:_svcs_fmri -i'
;;
(disable)
- _arguments \
- '-s[wait for service to become disabled]' \
- '-t[state change is temporary]' \
+ _arguments -A "-*" \
+ '-s[Wait for service to become disabled]' \
+ '-t[State change is temporary]' \
'*:instance FMRI:_svcs_fmri -i'
;;
(mark)
- _arguments \
- '-I[change state immediately]' \
- '-t[state change is temporary]' \
+ _arguments -A "-*" \
+ '-I[Change state immediately]' \
+ '-t[State change is temporary]' \
':state:(degraded maintenance)' \
':instance FMRI:_svcs_fmri -i'
;;
@@ -48,20 +48,19 @@ _svcadm() {
'*:instance FMRI:_svcs_fmri -i'
;;
+ (delegate)
+ _arguments -A "-*" \
+ '-s[Wait for instances to come online]' \
+ ':restarter FMRI:_svcs_fmri -r' \
+ '*:FMRI:_svcs_fmri -i'
+ ;;
+
(milestone)
- _arguments \
- '-d[make milestone the default]' \
+ _arguments -A "-*" \
+ '-d[Make milestone the default]' \
'*:milestone FMRI:_svcs_fmri -m'
;;
-# # The delegate subcommand has been removed, replaced by just using
-# # the restarter fmri
-# (delegate)
-# _arguments \
-# '1:restarter FMRI:_svcs_fmri -r' \
-# '*:instance FMRI:_svcs_fmri -i'
-# ;;
-
(*)
_message "unknown svcadm subcommand: $service"
esac
diff --git a/Completion/Solaris/Command/_svccfg b/Completion/Solaris/Command/_svccfg
index 10b84bda3..08c5e4bcd 100644
--- a/Completion/Solaris/Command/_svccfg
+++ b/Completion/Solaris/Command/_svccfg
@@ -21,7 +21,16 @@ _svccfg() {
local context state line subcmds
typeset -A opt_args
- subcmds=( apply describe extract import validate export inventory delete addpropvalue delpropvalue )
+ # Subcommands that don't make sense on the commandline are missing
+ subcmds=(
+ apply export extract import inventory validate
+ add delete list
+ addpg addpropvalue delcust delpg delprop delpropvalue describe
+ editprop listpg listprop listcust setenv setprop unsetenv
+ setnotify listnotify delnotify
+ listsnap revert selectsnap
+ refresh
+ )
if [[ $service == "svccfg" ]]; then
_arguments -s \
@@ -74,7 +83,13 @@ _svccfg() {
":property group or property:_svccfg_properties $fmri"
;;
- (extract)
+ (extract|add|delete|list|addpg|addpropvalue|delcust|delpg|delprop)
+ ;;
+
+ (delpropvalue|editprop|listpg|listprop|listcust|setenv|setprop|unsetenv)
+ ;;
+
+ (setnotify|listnotify|delnotify|listsnap|revert|selectsnap|refresh)
;;
(*)
diff --git a/Completion/Solaris/Command/_svcprop b/Completion/Solaris/Command/_svcprop
index 60d74a1ad..4a5436caf 100644
--- a/Completion/Solaris/Command/_svcprop
+++ b/Completion/Solaris/Command/_svcprop
@@ -11,6 +11,9 @@ _svcprop() {
'-p[prints values of named property or property group]' \
':FMRI:_svcs_fmri -i' \
- set2 \
+ '-a[display all properties]' \
+ '-g[group type filter]:group type:' \
+ '*-l[properties from a layer]:layer:(admin site-profile system-profile manifest)' \
'(-c -s)-C[retrieve properties without composition]' \
'(-C -s)-c[retrieve properties with composition]' \
'(-c -C)-s[retrieve properties from snapshot]:snapshot:' \
diff --git a/Completion/Solaris/Command/_zlogin b/Completion/Solaris/Command/_zlogin
index 8c55d8671..04018eb87 100644
--- a/Completion/Solaris/Command/_zlogin
+++ b/Completion/Solaris/Command/_zlogin
@@ -1,16 +1,19 @@
#compdef zlogin
+# Synced with the Nevada build 162 man page
_zlogin() {
_arguments -s \
- '-E[disable escape character]' \
- '-e[specify escape character]:character:' \
- '-l[specify username]:username:_users' \
- ':zonename:' \
+ '-E[Disable escape character]' \
+ '-e[Specify escape character]:character:' \
+ '-l[Specify username]:username:_users' \
+ ':zonename:_zones' \
- set1 \
- '-C[connect to zone console]' \
+ '-C[Connect to zone console]' \
+ '-d[Disconnect on zone halt]' \
- set2 \
- '-S["safe" login mode]' \
- ':utility'
+ '-S["Safe" login mode]' \
+ '(-):command name: _command_names -e' \
+ '*::utility: _normal'
}
_zlogin "$@"
diff --git a/Completion/Solaris/Command/_zoneadm b/Completion/Solaris/Command/_zoneadm
new file mode 100644
index 000000000..3f42673e1
--- /dev/null
+++ b/Completion/Solaris/Command/_zoneadm
@@ -0,0 +1,147 @@
+#compdef zoneadm
+# Synced with the S11U1 build 19 man page
+
+_zoneadm_bootargs() {
+ # This is a subset of the arguments to kernel(1M)
+ _arguments -A "-*" \
+ '-i[Alternate init]:path:_path_files' \
+ '-m[SMF options]:option:_values "SMF option" debug milestone= quiet verbose' \
+ '-s[Boot single user]'
+}
+
+_zoneadm() {
+ local context state line expl
+ typeset -A opt_args
+ local -a subcmds fields
+ local -a solaris_attach solaris_install
+ local -a solaris10_attach solaris10_install
+ local brand brand_args
+
+ subcmds=(
+ attach boot clone detach halt help install list mark move
+ ready reboot uninstall verify
+ )
+
+ solaris_attach=(
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to zonepath]:directory:_path_files -/'
+ )
+ solaris_install=(
+ - set1
+ '-c[Path to certificate]:path:_path_files'
+ '*-e[Additional package]:package:'
+ '-k[Path to key]:path:_path_files'
+ '-P[Publisher/URI mapping]:publisher:'
+ - set2
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to installed zone root]:directory:path_files -/'
+ '-p[Preserve system configuration]'
+ '-s[Install silently]'
+ '-u[Unconfigure after installation]'
+ '-v[Verbose]'
+ )
+
+ solaris10_attach=(
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to zonepath]:directory:_path_files -/'
+ )
+ solaris10_install=(
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to installed zone root]:directory:path_files -/'
+ '-p[Preserve system configuration]'
+ '-s[Install silently]'
+ '-u[Unconfigure after installation]'
+ '-v[Verbose]'
+ )
+
+ if [[ $service == "zoneadm" ]]; then
+ _arguments -C -A "-*" \
+ '-R[Alternate root]:alternate root:_path_files -/' \
+ '-u[Zone UUID]:zone UUID: ' \
+ '-z[Zone name]:zone name:_zones' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "zoneadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ ("boot")
+ # Completion of boot arguments after -- is kinda hacky.
+ _arguments -S -A "-*" \
+ '-w[Force writable root]' \
+ '-W[Boot in transient r/w mode]' \
+ '*:boot options:_zoneadm_bootargs'
+ ;;
+
+ ("clone")
+ _arguments -A "-*" \
+ '-m[Clone mode]:mode:_values "mode" copy' \
+ '-s[Source snapshot]:snapshot:_zfs_dataset -t snap' \
+ ':source zone:_zones'
+ ;;
+
+ ("attach")
+ if [[ -n $opt_args[-z] ]]; then
+ brand=${"${(@s,:,)$(zoneadm -z $opt_args[-z] list -p)}"[6]}
+ brand_args=${brand}_attach
+ fi
+ _arguments -A "-*" \
+ '-F[Force attach]' \
+ '-n[Path to zone manifest]:path to zone manifest:_path_files' \
+ '-u[Update on attach]' \
+ ${(P)brand_args}
+ ;;
+
+ ("detach")
+ _arguments -A "-*" \
+ '-n[Dry run]'
+ ;;
+
+ ("halt"|"ready"|"reboot"|"verify")
+ ;;
+
+
+ ("help")
+ _wanted commands expl "zoneadm subcommand" compadd -a subcmds
+ ;;
+
+ ("install")
+ if [[ -n $opt_args[-z] ]]; then
+ brand=${"${(@s,:,)$(zoneadm -z $opt_args[-z] list -p)}"[6]}
+ brand_args=${brand}_install
+ fi
+ _arguments -A "-*" \
+ ${(P)brand_args}
+ ;;
+
+ ("list")
+ _arguments -A "-*" \
+ '-c[Configured zones]' \
+ '-i[Installed zones]' \
+ '(-v)-p[Parsable output]' \
+ '(-p)-v[Verbose mode]'
+ ;;
+
+ ("mark")
+ _arguments -A "-*" \
+ ':state:(incomplete unavailable)'
+ ;;
+
+ ("move")
+ _arguments -A "-*" \
+ ':new zone path:_path_files -/'
+ ;;
+
+ ("uninstall")
+ _arguments -A "-*" \
+ '-F[Force]'
+ ;;
+ esac
+}
+
+_zoneadm "$@"
diff --git a/Completion/Solaris/Type/.distfiles b/Completion/Solaris/Type/.distfiles
index 8db1e1aaa..2f937ee13 100644
--- a/Completion/Solaris/Type/.distfiles
+++ b/Completion/Solaris/Type/.distfiles
@@ -1,4 +1,6 @@
DISTFILES_SRC='
.distfiles
+_be_name
_svcs_fmri
+_zones
'
diff --git a/Completion/Solaris/Type/_be_name b/Completion/Solaris/Type/_be_name
new file mode 100644
index 000000000..b25a8ff22
--- /dev/null
+++ b/Completion/Solaris/Type/_be_name
@@ -0,0 +1,18 @@
+#autoload
+
+local -a type be_names
+local name uuid activate mtpt space policy created snap
+
+zparseopts -D -E -a type t+:
+
+beadm list -H | while IFS=\; read name uuid active mtpt space policy created; do
+ be_names=( $be_names $name )
+done
+
+if [[ -n $type[(r)all] ]]; then
+ beadm list -sH | while IFS=\; read name snap space policy created; do
+ be_names=( $be_names $snap )
+ done
+fi
+
+compadd "$@" - $be_names
diff --git a/Completion/Solaris/Type/_svcs_fmri b/Completion/Solaris/Type/_svcs_fmri
index 684dc8d6d..80d3516c0 100644
--- a/Completion/Solaris/Type/_svcs_fmri
+++ b/Completion/Solaris/Type/_svcs_fmri
@@ -22,39 +22,52 @@ _svcs_fmri() {
# Grab all FMRIs that have a word beginning with $PREFIX,
# making sure not to return the portion of the FMRI before
# $PREFIX. Use the cache if it exists and the user wants to.
- if ( [[ $#_smf_fmris -eq 0 ]] || _cache_invalid $cache_id ) && ! _retrieve_cache $cache_id; then
+ if ( [[ $#_smf_fmris -eq 0 ]] || _cache_invalid $cache_id ) \
+ && ! _retrieve_cache $cache_id; then
_smf_fmris=( ${(f)"$(svcs -a -H -o fmri)"} )
_store_cache $cache_id _smf_fmris
fi
- # Each element of the array is removed which doesn't match (^|.*/)$PREFIX.*
+ # Each element of the array is removed which doesn't match
+ # (^|.*/)$PREFIX.*
fmri_abbrevs=( ${(M)_smf_fmris:#((#s)|*[/:])$PREFIX*} )
# Go through the remaining elements and remove the characters
# in front of $PREFIX.
- for i in {1..$#fmri_abbrevs}; do
+ for ((i = 1; i <= $#fmri_abbrevs; i++ )); do
# Either one of these will work, but they're too
# greedy, preventing multiple matches below.
fmri_abbrevs[i]=${${fmri_abbrevs[i]}/((#s)|*[\/:])(#b)($PREFIX*)/$match[1]}
#fmri_abbrevs[i]=${${(M)${fmri_abbrevs[i]}:#(#b)((#s)|*/)$PREFIX*}#$match[1]}
done
- # Remove the "default" instance identifier if we can (not for
- # svccfg)
- # TODO Can't remove default when there are other instances.
+ # Remove the "default" instance identifier if it's the only
+ # instance for a given service (not for svccfg).
if [[ $type == "-i" ]]; then
- fmri_abbrevs=( ${fmri_abbrevs//:default(#e)/} )
+ local -a svcs insts nabbrevs
+ local s
+ svcs=( ${(u)fmri_abbrevs%:*} )
+ for s in $svcs; do
+ insts=( ${(@M)fmri_abbrevs:#$s:*} )
+ if [[ $#insts -eq 1 && $insts[1] == *":default" ]]; then
+ nabbrevs=($nabbrevs ${insts//:default})
+ elif [[ $#insts -eq 0 ]]; then
+ # Turns out we're completing the
+ # instance name.
+ nabbrevs=($nabbrevs $s)
+ else
+ nabbrevs=($nabbrevs $insts)
+ fi
+ done
+ fmri_abbrevs=( $nabbrevs )
fi
- # Search for a second match within each result.
- # for m in $fmri_abbrevs; do
- # if [[ -n ${(M)m:#((#s)|*/)$PREFIX*/$PREFIX*} ]]; then
- # fmri_abbrevs=( $fmri_abbrevs ${${(SMI:1:)m%%/$PREFIX*}#/} )
- # fi
- # done
+ # After playing with _multi_parts, I'm not sure it's actually
+ # that useful.
+ # _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
+ # _multi_parts -i / fmri_abbrevs
- # After playing with _multi_parts, I'm not sure it's actually that useful.
- # _wanted fmri expl "full or unambiguously abbreviated FMRIs" _multi_parts / fmri_abbrevs
- _wanted fmri expl "full or unambiguously abbreviated FMRIs" compadd $fmri_abbrevs
+ _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
+ compadd $fmri_abbrevs
;;
(-m)
@@ -64,7 +77,8 @@ _svcs_fmri() {
(-r)
# TODO: need some way to pick out only restarters
- _wanted fmri expl "restarter FMRIs" compadd master svc:/network/inetd:default
+ _wanted fmri expl "restarter FMRIs" \
+ compadd master reset svc:/network/inetd:default
;;
(*)
diff --git a/Completion/Solaris/Type/_zones b/Completion/Solaris/Type/_zones
new file mode 100644
index 000000000..0c2d273a2
--- /dev/null
+++ b/Completion/Solaris/Type/_zones
@@ -0,0 +1,13 @@
+#autoload
+
+local -a type typearg
+local zonelist
+
+zparseopts -D -E -a type t+:
+
+[[ -n $type[(r)c] ]] && typearg=-c
+[[ -n $type[(r)i] ]] && typearg=-i
+
+zonelist=( ${="$(zoneadm list $typearg)"} )
+
+compadd "$@" - $zonelist
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index e54c6c0d2..355cb9cf9 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -83,6 +83,7 @@ _go
_gpg
_gphoto2
_gprof
+_gradle
_graphicsmagick
_grep
_groff
@@ -130,6 +131,7 @@ _mh
_mkdir
_module
_monotone
+_mosh
_mount
_mpc
_mt
@@ -211,7 +213,7 @@ _subversion
_sudo
_surfraw
_sysctl
-_systemctl
+_systemd
_tar
_tardy
_tcpdump
diff --git a/Completion/Unix/Command/_getconf b/Completion/Unix/Command/_getconf
index 76d9c7686..f2c713a52 100644
--- a/Completion/Unix/Command/_getconf
+++ b/Completion/Unix/Command/_getconf
@@ -27,7 +27,7 @@ if [[ CURRENT -eq 2 ]]; then
_tags syswideconfig pathconfig standardsconfig confstring restconfig
allkeys=(${${(f)"$(getconf -a 2>/dev/null)"}%%[: ]*})
- restkeys=(${allkeys:#(${(j.|.)~mykeys})})
+ restkeys=(${allkeys:|mykeys})
while _tags; do
_requested -V syswideconfig expl 'systemwide configuration variables' \
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 5ed921850..88c765fb0 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5753,6 +5753,7 @@ __git_setup_merge_options () {
'(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]'
'( --no-squash)--squash[merge, but do not commit]'
'(--squash )--no-squash[merge and commit]'
+ '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]'
'*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies'
'*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]'
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle
new file mode 100644
index 000000000..bc5aed0cd
--- /dev/null
+++ b/Completion/Unix/Command/_gradle
@@ -0,0 +1,114 @@
+#compdef gradle gradlew
+
+local curcontext="$curcontext" ret=1 state state_descr line
+local gradle_inspect=yes cache_policy tag_order
+local -A opt_args
+local -a gradle_group_tasks gradle_all_tasks
+
+# Set the caching policy to invalidate cache if the build file is newer than the cache.
+_gradle_caching_policy() {
+ [[ $gradle_buildfile -nt $1 ]]
+}
+
+zstyle -s ":completion:*:*:$service:*" cache-policy cache_policy || \
+ zstyle ":completion:*:*:$service:*" cache-policy _gradle_caching_policy
+
+# By default, we only complete main tasks (belonging to a group). Secondary tasks are
+# completed if no main tasks are found.
+zstyle -a ":completion:*:*:$service:*" tag-order tag_order || \
+ zstyle ":completion:*:*:$service:*" tag-order 'gradle_group' 'gradle_all'
+
+# The completion inspects the current build file to find tasks to complete. Setting
+# this style to 'no' or 'false' turns off inspection. In that case only the built-in tasks
+# are completed.
+zstyle -T ":completion:*:*:$service:*" gradle-inspect || gradle_inspect=no
+
+_arguments -C \
+ '(-)'{-\?,-h,--help}'[Shows this help message.]' \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ {-b,--build-file}'[Specifies the build file.]:build file:_files -g "*.gradle(-.)"' \
+ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
+ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g "*.properties(-.)"' \
+ '--continue[Continues task execution after a task failure.]' \
+ \*{-D+,--system-prop}'[Set system property of the JVM (e.g. -Dmyprop=myvalue).]:system property (prop=val):' \
+ '(-i --info -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ '(--nodaemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '--foreground[Starts the Gradle daemon in the foreground.]' \
+ {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:home directory:_directories' \
+ '(-)--gui[Launches the Gradle GUI.]' \
+ {-I,--init-script}'[Specifies an initialization script.]:init script:_files -g "*.gradle(-.)"' \
+ '(-d --debug -q --quiet)'{-i,--info}'[Set log level to info.]' \
+ {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
+ '--no-color[Do not use color in the console output.]' \
+ '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
+ '--no-opt[Ignore any task optimization.]' \
+ '--offline[The build should operate without accessing network resources.]' \
+ \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories' \
+ '--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
+ '--project-cache-dir[Specifies the project-specific cache directory.]:cache directory:_directories' \
+ '(-d --debug -i --info)'{-q,--quiet}'[Log errors only.]' \
+ "--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)" \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-)--stop[Stops the Gradle daemon if it is running.]' \
+ {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
+ '(-)'{-v,--version}'[Print version info.]' \
+ {-x,--exclude-task}'[Specify a task to be excluded from execution.]:task to exclude:->alltask' \
+ '*:task:->task' \
+ && ret=0
+
+if [[ -n $state ]]; then
+ if [[ $gradle_inspect == yes ]]; then
+ # If a build file is specified after '-b' or '--build-file', use this file. Otherwise,
+ # default is the file 'build.gradle' in the current directory.
+ local gradle_buildfile=${${(v)opt_args[(i)-b|--build-file]}:-build.gradle}
+
+ if [[ -f $gradle_buildfile ]]; then
+ # Cache name is constructed from the absolute path of the build file.
+ local cache_name=${${gradle_buildfile:a}//[^[:alnum:]]/_}
+ if _cache_invalid $cache_name || ! _retrieve_cache $cache_name; then
+ zle -R "Generating cache from $gradle_buildfile"
+ local outputline
+ local -a match mbegin mend
+ # Run gradle/gradlew and retrieve possible tasks.
+ for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do
+ if [[ $outputline == [[:blank:]]#(#b)([[:alnum:]]##)' - '(*) ]]; then
+ # The descriptions of main tasks start at beginning of line, descriptions of
+ # secondary tasks are indented.
+ if [[ $outputline == [[:alnum:]]* ]]; then
+ gradle_group_tasks+=( "$match[1]:$match[2]" )
+ else
+ gradle_all_tasks+=( "$match[1]:$match[2]" )
+ fi
+ fi
+ done
+ _store_cache $cache_name gradle_group_tasks gradle_all_tasks
+ fi
+
+ if [[ $state == task ]]; then
+ _tags gradle_group gradle_all
+ while _tags; do
+ # Offer main tasks and secondary tasks in different tags.
+ _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0
+ _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0
+ (( ret )) || break
+ done
+ elif [[ $state == alltask ]]; then
+ # After '--exclude-task', we don't make a distinction between main tasks and
+ # secondary tasks.
+ _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0
+ fi
+ fi
+ else
+ _describe 'built-in tasks' '(
+ "dependencies:Displays the dependencies of root project."
+ "help:Displays a help message."
+ "projects:Displays the sub-projects of root project."
+ "properties:Displays the properties of root project."
+ "tasks:Displays the tasks runnable from root project."
+ )' && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d
index dd9933a46..bbf62fc0d 100644
--- a/Completion/Unix/Command/_init_d
+++ b/Completion/Unix/Command/_init_d
@@ -68,6 +68,7 @@ else
what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
+ [[ -x $script ]] || return 1
read -u0 -k2 magic < $script && [[ $magic = '#!' ]] &&
cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} )
diff --git a/Completion/Unix/Command/_mosh b/Completion/Unix/Command/_mosh
new file mode 100644
index 000000000..c940f9015
--- /dev/null
+++ b/Completion/Unix/Command/_mosh
@@ -0,0 +1,12 @@
+#compdef mosh
+
+_arguments \
+ '--client=:client helper:_command_names -e' \
+ '--server=:server helper:_files' \
+ '--ssh=:ssh command to run:_files' \
+ '(-a -n)--predict=:when:(adaptive always never)' \
+ '(--predict -n)-a[predict always]' \
+ '(--predict -a)-n[predict never]' \
+ {-p,--port=}':port:_ports' \
+ ':remote:_hosts' \
+ ':remote command:_command_names -e'
diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount
index 409d253ab..b48aaa236 100644
--- a/Completion/Unix/Command/_mount
+++ b/Completion/Unix/Command/_mount
@@ -690,7 +690,7 @@ if [[ "$service" = mount ]]; then
deffs=hsfs
typeops=-F
;;
- freebsd*|dragonfly*)
+ freebsd*|dragonfly*|darwin*)
args=( -s
'(:)-a[mount all filesystems in fstab]'
'-d[cause everything to be done except for the actual system call]'
@@ -765,7 +765,7 @@ else
'*:dev or dir:->udevordir'
)
;;
- freebsd*|dragonfly*)
+ freebsd*|dragonfly*|darwin*)
args=(
'(*)-a[unmount all mounted file systems]'
'-A[unmount all mounted file systems except the root]'
@@ -904,6 +904,11 @@ udevordir)
mp_tmp+=( $mline[(w)3] )
done
;;
+ darwin*)
+ tmp=( "${(@f)$(/sbin/mount)}" )
+ dev_tmp=( "${(@)${(@)tmp%% *}:#map}" )
+ mp_tmp=( "${(@)${(@)tmp#* on }%% \(*}" )
+ ;;
*)
/sbin/mount | while read mline; do
mp_tmp+=( $mline[(w)1] )
diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt
index 130f38149..2ceb2ffaa 100644
--- a/Completion/Unix/Command/_quilt
+++ b/Completion/Unix/Command/_quilt
@@ -32,8 +32,8 @@ _arguments \
'--quiltrc[Use the specified configuration file]:files:_files' \
'--version[Print the version number and exit]' \
':quilt command:(add annotate applied delete diff edit files fold fork graph
- grep header import mail new next patches pop previous push refresh rename
- revert series setup shell snapshot top unapplied upgrade)' \
+ grep header import mail new next patches pop previous push refresh remove
+ rename revert series setup snapshot top unapplied upgrade)' \
'*::subcmd:->subcmd' && return 0
case "$state" in (subcmd)
@@ -109,6 +109,9 @@ case "$state" in (subcmd)
'-T ps[Directly produce a PostScript output file]' \
':quilt series:_quilt_series'
;;
+ (grep)
+ _arguments '-h'
+ ;;
(header)
_arguments '-h' \
'-a[Append the exiting patch header]' \
@@ -131,6 +134,7 @@ case "$state" in (subcmd)
(mail)
_arguments '-h' \
'-m[Text to use as the text in the introduction]:quilt select text: ' \
+ '-M[Like the -m option, but read the introduction from file]:files:_files' \
'--prefix[Use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \
'--mbox[Store all messages in the specified file in mbox format]:files:_files' \
'--send[Send the messages directly]' \
@@ -145,7 +149,8 @@ case "$state" in (subcmd)
'*:quilt series:_quilt_series'
;;
(new)
- _arguments '-h'
+ _arguments '-h' \
+ '-p[Select a patch style]:quilt patch style:(0 1 ab)'
;;
(next)
_arguments '-h' \
@@ -175,6 +180,8 @@ case "$state" in (subcmd)
'-q[Quiet operation]' \
'-f[Force apply, even if the patch has rejects]' \
'-v[Verbose operation]' \
+ '--fuzz[Set the maximum fuzz factor]' \
+ '--merge=[Merge the patch file into the original files]:quilt select merge:(merge diff3)' \
'--leave-rejects[Leave around the reject files patch produced]' \
'--color=[Use syntax coloring]:quilt select color:(always auto never)' \
':quilt unapplied:_quilt_unapplied'
@@ -196,6 +203,10 @@ case "$state" in (subcmd)
'--strip-trailing-whitespace[Strip trailing whitespace at the end of lines]' \
':quilt series:_quilt_series'
;;
+ (remove)
+ _arguments '-h' \
+ '-P[Patch to remove]:quilt series:_quilt_series'
+ ;;
(rename)
_arguments '-h' \
'-P[Patch to rename]:quilt series:_quilt_series'
@@ -214,12 +225,9 @@ case "$state" in (subcmd)
'-d[Optional path prefix for the resulting source tree]:quilt select path-prefix: ' \
'--sourcedir[Directory that contains the package sources]:quilt select package sources directory: ' \
'-v[Verbose debug output]' \
+ '--fuzz[Set the maximum fuzz factor]' \
':files:_files'
;;
- (shell)
- _arguments '-h' \
- ':quilt select shell command:_command_names -e'
- ;;
(snapshot)
_arguments '-h' \
'-d[Remove current snapshot]'
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 8f1fb74aa..7e85e2bb6 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -1,6 +1,6 @@
-#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp
+#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp ssh-copy-id
-# Completions currently based on OpenSSH 5.9 (released on 2011-09-06).
+# Completions currently based on OpenSSH 6.0 (released on 2012-04-22).
#
# TODO: update ssh-keygen (not based on 5.9)
# TODO: sshd, ssh-keyscan, ssh-keysign
@@ -18,7 +18,7 @@ _ssh () {
# for protocol version 2, this can be a comma-separated list
'-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)'
'-F+[specify alternate config file]:config file:_files'
- '-i+[select identity file]:SSH identity file:_files'
+ '*-i+[select identity file]:SSH identity file:_files'
'*-o+[specify extra options]:option string:->option'
)
common_transfer=(
@@ -50,7 +50,7 @@ _ssh () {
'(-1)-m+[specify mac algorithms]:mac spec:->macs' \
'(-1)-N[do not execute a remote command (protocol version 2 only)]' \
'-n[redirect stdin from /dev/null]' \
- '-O:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests"))' \
+ '-O:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R"))' \
'-P[use non privileged port]' \
'-p+[specify port on remote host]:port number on remote host' \
'(-v)*-q[quiet operation]' \
@@ -133,6 +133,11 @@ _ssh () {
'-s[SSH2 subsystem or path to sftp server on the remote host]' \
'1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
;;
+ (ssh-copy-id)
+ _arguments \
+ '-i:SSH identity file:_files' \
+ ':remote host name:->userhost' \
+ ;;
esac
while [[ -n "$state" ]]; do
diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl
deleted file mode 100644
index 3f54092a1..000000000
--- a/Completion/Unix/Command/_systemctl
+++ /dev/null
@@ -1,311 +0,0 @@
-#compdef systemctl
-
-# Copyright (c) 2011 Foudil Brétel <foudil.newbie+zshsystemctl@gmail.com>
-#
-# This file is released under the GPLv3.
-#
-# inspired from _yum and systemctl-bash-completion.sh (shipped with systemctl)
-#
-# TODO: enable options after commands. Ex: systemctl list-units --all --full
-
-# Main dispatcher
-_systemctl()
-{
- local curcontext="$curcontext" state lstate line
-
- # -s for aggregated options like -aP
- _arguments -s \
- {-h,--help}'[Show help]' \
- '--version[Show package version]' \
- {-t,--type=}'[List only units of a particular type]:unit type:(automount device mount path service snapshot socket swap target timer)' \
- \*{-p,--property=}'[Show only properties by specific name]:unit property:' \
- {-a,--all}'[Show all units/properties, including dead/empty ones]' \
- '--failed[Show only failed units]' \
- "--full[Don't ellipsize unit names on output]" \
- '--fail[When queueing a new job, fail if conflicting jobs are pending]' \
- '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
- '--kill-mode=[How to send signal]:killmode:(control-group process)' \
- '--kill-who=[Who to send signal to]:killwho:(main control all)' \
- {-s,--signal=}'[Which signal to send]:signal:_signals' \
- {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
- {-P,--privileged}'[Acquire privileges before execution]' \
- {-q,--quiet}'[Suppress output]' \
- '--no-block[Do not wait until operation finished]' \
- "--no-wall[Don't send wall message before halt/power-off/reboot]" \
- "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
- '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \
- '--no-pager[Do not pipe output into a pager]' \
- '--no-ask-password[Do not ask for system passwords]' \
- '--order[When generating graph for dot, show only order]' \
- '--require[When generating graph for dot, show only requirement]' \
- '--system[Connect to system manager]' \
- '--user[Connect to user service manager]' \
- '--global[Enable/disable unit files globally]' \
- {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
- '--defaults[When disabling unit files, remove default symlinks only]' \
- '--root=[Enable unit files in the specified root directory]:directory:_directories' \
- '*::systemctl command:_systemctl_command'
-}
-
-_hosts_or_user_at_host()
-{
- _alternative \
- 'users-hosts:: _user_at_host' \
- 'hosts:: _hosts'
-}
-
-(( $+functions[_systemctl_command] )) || _systemctl_command()
-{
- local -a _systemctl_cmds
- _systemctl_cmds=(
- "list-units:List units"
- "start:Start (activate) one or more units"
- "stop:Stop (deactivate) one or more units"
- "reload:Reload one or more units"
- "restart:Start or restart one or more units"
- "condrestart:Restart one or more units if active"
- "try-restart:Restart one or more units if active"
- "reload-or-restart:Reload one or more units is possible, otherwise start or restart"
- "force-reload:Reload one or more units is possible, otherwise restart if active"
- "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active"
- "isolate:Start one unit and stop all others"
- "kill:Send signal to processes of a unit"
- "is-active:Check whether units are active"
- "status:Show runtime status of one or more units"
- "show:Show properties of one or more units/jobs or the manager"
- "reset-failed:Reset failed state for all, one, or more units"
- "list-unit-files:List installed unit files"
- "enable:Enable one or more unit files"
- "disable:Disable one or more unit files"
- "preset:Enable/disable one or more unit files based on preset configuration"
- "mask:Mask one or more units"
- "unmask:Unmask one or more units"
- "link:Link one or more units into the search path"
- "is-enabled:Check whether unit files are enabled"
- "load:Load one or more units"
- "list-jobs:List jobs"
- "cancel:Cancel all, one, or more jobs"
- "monitor:Monitor unit/job changes"
- "dump:Dump server status"
- "dot:Dump dependency graph for dot(1)"
- "snapshot:Create a snapshot"
- "delete:Remove one or more snapshots"
- "daemon-reload:Reload systemd manager configuration"
- "daemon-reexec:Reexecute systemd manager"
- "show-environment:Dump environment"
- "set-environment:Set one or more environment variables"
- "unset-environment:Unset one or more environment variables"
- "default:Enter system default mode"
- "rescue:Enter system rescue mode"
- "emergency:Enter system emergency mode"
- "halt:Shut down and halt the system"
- "poweroff:Shut down and power-off the system"
- "reboot:Shut down and reboot the system"
- "kexec:Shut down and reboot the system with kexec"
- "exit:Ask for user instance termination"
- )
-
- if (( CURRENT == 1 )); then
- _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
- else
- local curcontext="$curcontext"
-
- cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
- # Deal with any aliases
- case $cmd in
- condrestart) cmd="try-restart";;
- force-reload) cmd="reload-or-try-restart";;
- esac
-
- if (( $#cmd )); then
- curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
-
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
- fi
-
- _call_function ret _systemctl_$cmd || _message 'no more arguments'
- else
- _message "unknown systemctl command: $words[1]"
- fi
- return ret
- fi
-}
-
-__check_option_nolegend()
-{
- systemctl --no-legend --version 2>&1 | grep -q 'unrecognized option'
- print -Pn '%(?..--no-legend)'
-}
-nolegend=$(__check_option_nolegend)
-
-
-# Fills the unit lists
-_systemctl_all_units()
-{
- if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
- ! _retrieve_cache SYS_ALL_UNITS;
- then
- _sys_all_units=( $(systemctl ${nolegend} list-units --full --all \
- | cut -d' ' -f1 2>/dev/null) )
- _store_cache SYS_ALL_UNITS _sys_all_units
- fi
-}
-
-_systemctl_inactive_units()
-{
- _sys_inactive_units=( $(systemctl ${nolegend} list-units --full --all \
- | awk '$3 != "active" {print $1}' 2>/dev/null) )
-}
-
-_systemctl_active_units()
-{
- _sys_active_units=( $(systemctl ${nolegend} list-units --full \
- | cut -d' ' -f1 2>/dev/null) )
-}
-
-_systemctl_failed_units()
-{
- _sys_failed_units=( $(systemctl ${nolegend} list-units --full --failed \
- | cut -d' ' -f1 2>/dev/null) )
-}
-
-_filter_units_by_property () {
- local property=$1 value=$2 ; shift ; shift
- local -a units ; units=($*)
- local -a props ; props=( $(systemctl show --property "$property" -- \
- ${units[*]} | grep -v '^$') )
- for ((i=1; $i <= ${#units[*]}; i++)); do
- if [[ "${props[i]}" = "$property=$value" ]]; then
- echo "${units[i]}"
- fi
- done
-}
-
-# Completion functions for ALL_UNITS
-for fun in enable disable is-active is-enabled status show ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_all_units
- compadd "$@" -a - _sys_all_units
- }
-done
-
-# Completion functions for STARTABLE_UNITS
-(( $+functions[_systemctl_start] )) || _systemctl_start()
-{
- _systemctl_inactive_units
- compadd "$@" - $( _filter_units_by_property CanStart yes \
- ${_sys_inactive_units[*]} | grep -Ev '\.(device|snapshot)$' )
-}
-
-# Completion functions for RESTARTABLE_UNITS
-for fun in restart reload-or-restart ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_all_units
- compadd "$@" - $( _filter_units_by_property CanStart yes \
- ${_sys_all_units[*]} | grep -Ev '\.(device|snapshot|socket|timer)$' )
- }
-done
-
-# Completion functions for STOPPABLE_UNITS
-for fun in stop kill try-restart condrestart ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_active_units
- compadd "$@" - $( _filter_units_by_property CanStop yes \
- ${_sys_active_units[*]} )
- }
-done
-
-# Completion functions for RELOADABLE_UNITS
-for fun in reload reload-or-try-restart force-reload ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_active_units
- compadd "$@" - $( _filter_units_by_property CanReload yes \
- ${_sys_active_units[*]} )
- }
-done
-
-# Completion functions for ISOLATABLE_UNITS
-(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
-{
- _systemctl_all_units
- compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
- ${_sys_all_units[*]} )
-}
-
-# Completion functions for FAILED_UNITS
-(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
-{
- _systemctl_failed_units
- compadd "$@" -a - _sys_failed_units || _message "no failed-unit found"
-}
-
-# Completion functions for JOBS
-(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
-{
- compadd "$@" - $(systemctl ${nolegend} list-jobs \
- | cut -d' ' -f1 2>/dev/null ) || _message "no job found"
-}
-
-# Completion functions for SNAPSHOTS
-(( $+functions[_systemctl_delete] )) || _systemctl_delete()
-{
- compadd "$@" - $(systemctl ${nolegend} list-units --type snapshot --full \
- --all | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found"
-}
-
-# Completion functions for ENVS
-for fun in set-environment unset-environment ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- local fun=$0 ; fun=${fun##_systemctl_}
- local suf
- if [[ "${fun}" = "set-environment" ]]; then
- suf='-S='
- fi
-
- compadd "$@" ${suf} - $(systemctl show-environment \
- | sed 's_\([^=]\+\)=.*_\1_' )
- }
-done
-
-# no completion for:
-# [STANDALONE]='daemon-reexec daemon-reload default dot dump emergency exit
-# halt kexec list-jobs list-units monitor poweroff reboot
-# rescue show-environment'
-# [NAME]='snapshot load'
-
-_systemctl_caching_policy()
-{
- local _sysunits
- local -a oldcache
-
- # rebuild if cache is more than a day old
- oldcache=( "$1"(mh+1) )
- (( $#oldcache )) && return 0
-
- _sysunits=($(systemctl ${nolegend} --full --all | cut -d' ' -f1))
-
- if (( $#_sysunits )); then
- for unit in $_sysunits; do
- [[ "$unit" -nt "$1" ]] && return 0
- done
- fi
-
- return 1
-}
-
-_systemctl "$@"
-
-# Local Variables:
-# mode: sh
-# sh-indentation: 2
-# indent-tabs-mode: nil
-# sh-basic-offset: 2
-# End:
diff --git a/Completion/Unix/Command/_systemd b/Completion/Unix/Command/_systemd
new file mode 100644
index 000000000..585ed9c41
--- /dev/null
+++ b/Completion/Unix/Command/_systemd
@@ -0,0 +1,459 @@
+#compdef systemctl systemd-loginctl
+
+# Copyright (c) 2011 Foudil Brétel <foudil.newbie+zshsystemctl@gmail.com>
+#
+# This file is released under the GPLv3.
+#
+# inspired from _yum and systemctl-bash-completion.sh (shipped with systemctl)
+#
+# TODO: enable options after commands. Ex: systemctl list-units --all --full
+
+# Main dispatcher
+_systemd()
+{
+ local curcontext="$curcontext" state lstate line
+
+ case "$service" in
+ systemctl)
+ # -s for aggregated options like -aP
+ _arguments -s \
+ {-h,--help}'[Show help]' \
+ '--version[Show package version]' \
+ {-t,--type=}'[List only units of a particular type]:unit type:(automount device mount path service snapshot socket swap target timer)' \
+ \*{-p,--property=}'[Show only properties by specific name]:unit property:()' \
+ {-a,--all}'[Show all units/properties, including dead/empty ones]' \
+ '--failed[Show only failed units]' \
+ "--full[Don't ellipsize unit names on output]" \
+ '--fail[When queueing a new job, fail if conflicting jobs are pending]' \
+ '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
+ '--kill-mode=[How to send signal]:killmode:(control-group process)' \
+ '--kill-who=[Who to send signal to]:killwho:(main control all)' \
+ {-s,--signal=}'[Which signal to send]:signal:_signals' \
+ {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
+ {-P,--privileged}'[Acquire privileges before execution]' \
+ {-q,--quiet}'[Suppress output]' \
+ '--no-block[Do not wait until operation finished]' \
+ "--no-wall[Don't send wall message before halt/power-off/reboot]" \
+ "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
+ '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ '--no-ask-password[Do not ask for system passwords]' \
+ '--order[When generating graph for dot, show only order]' \
+ '--require[When generating graph for dot, show only requirement]' \
+ '--system[Connect to system manager]' \
+ '--user[Connect to user service manager]' \
+ '--global[Enable/disable unit files globally]' \
+ {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
+ '--root=[Enable unit files in the specified root directory]:directory:_directories' \
+ '--runtime[Enable unit files only temporarily until next reboot]' \
+ '*::systemctl command:_systemctl_command'
+ ;;
+
+ systemd-loginctl)
+ _arguments -s \
+ {-h,--help}'[Show help]' \
+ '--version[Show package version]' \
+ \*{-p,--property=}'[Show only properties by this name]:unit property:' \
+ {-a,--all}'[Show all properties, including empty ones]' \
+ '--failed[Show only failed units]' \
+ '--kill-who=[Who to send signal to]:killwho:(main control all)' \
+ {-s,--signal=}'[Which signal to send]:signal:_signals' \
+ {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
+ {-P,--privileged}'[Acquire privileges before execution]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ '*::systemd-loginctl command:_systemd_loginctl_command'
+ ;;
+
+ *) _message 'eh?' ;;
+ esac
+
+}
+
+_hosts_or_user_at_host()
+{
+ _alternative \
+ 'users-hosts:: _user_at_host' \
+ 'hosts:: _hosts'
+}
+
+(( $+functions[_systemctl_command] )) || _systemctl_command()
+{
+ local -a _systemctl_cmds
+ _systemctl_cmds=(
+ "list-units:List units"
+ "start:Start (activate) one or more units"
+ "stop:Stop (deactivate) one or more units"
+ "reload:Reload one or more units"
+ "restart:Start or restart one or more units"
+ "condrestart:Restart one or more units if active"
+ "try-restart:Restart one or more units if active"
+ "reload-or-restart:Reload one or more units is possible, otherwise start or restart"
+ "force-reload:Reload one or more units is possible, otherwise restart if active"
+ "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active"
+ "isolate:Start one unit and stop all others"
+ "kill:Send signal to processes of a unit"
+ "is-active:Check whether units are active"
+ "status:Show runtime status of one or more units"
+ "show:Show properties of one or more units/jobs or the manager"
+ "reset-failed:Reset failed state for all, one, or more units"
+ "load:Load one or more units"
+ "list-unit-files:List installed unit files"
+ "enable:Enable one or more unit files"
+ "disable:Disable one or more unit files"
+ "reenable:Reenable one or more unit files"
+ "preset:Enable/disable one or more unit files based on preset configuration"
+ "mask:Mask one or more units"
+ "unmask:Unmask one or more units"
+ "link:Link one or more units files into the search path"
+ "is-enabled:Check whether unit files are enabled"
+ "list-jobs:List jobs"
+ "cancel:Cancel all, one, or more jobs"
+ "dump:Dump server status"
+ "dot:Dump dependency graph for dot(1)"
+ "snapshot:Create a snapshot"
+ "delete:Remove one or more snapshots"
+ "show-environment:Dump environment"
+ "set-environment:Set one or more environment variables"
+ "unset-environment:Unset one or more environment variables"
+ "daemon-reload:Reload systemd manager configuration"
+ "daemon-reexec:Reexecute systemd manager"
+ "default:Enter system default mode"
+ "rescue:Enter system rescue mode"
+ "emergency:Enter system emergency mode"
+ "halt:Shut down and halt the system"
+ "poweroff:Shut down and power-off the system"
+ "reboot:Shut down and reboot the system"
+ "kexec:Shut down and reboot the system with kexec"
+ "exit:Ask for user instance termination"
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+
+ cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
+ # Deal with any aliases
+ case $cmd in
+ condrestart) cmd="try-restart";;
+ force-reload) cmd="reload-or-try-restart";;
+ esac
+
+ if (( $#cmd )); then
+ curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
+
+ local update_policy
+ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
+ if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
+ fi
+
+ _call_function ret _systemctl_$cmd || _message 'no more arguments'
+ else
+ _message "unknown systemctl command: $words[1]"
+ fi
+ return ret
+ fi
+}
+
+__systemctl()
+{
+ systemctl --full --no-legend --no-pager "$@"
+}
+
+
+# Fills the unit list
+_systemctl_all_units()
+{
+ if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
+ ! _retrieve_cache SYS_ALL_UNITS;
+ then
+ _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo "$a"; done; }) )
+ _store_cache SYS_ALL_UNITS _sys_all_units
+ fi
+}
+
+# Fills the unit list including all file units
+_systemctl_really_all_units()
+{
+ local -a all_unit_files;
+ local -a really_all_units;
+ if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) &&
+ ! _retrieve_cache SYS_REALLY_ALL_UNITS;
+ then
+ all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo "$a"; done; }) )
+ _systemctl_all_units
+ really_all_units=($_sys_all_units $all_unit_files)
+ _sys_really_all_units=(${(u)really_all_units})
+ _store_cache SYS_REALLY_ALL_UNITS _sys_really_all_units
+ fi
+}
+
+_filter_units_by_property() {
+ local property=$1 value=$2 ; shift ; shift
+ local -a units ; units=($*)
+ local prop unit
+ for ((i=1; $i <= ${#units[*]}; i++)); do
+ # FIXME: "Failed to issue method call: Unknown unit" errors are ignored for
+ # now (related to DBUS_ERROR_UNKNOWN_OBJECT). in the future, we need to
+ # revert to calling 'systemctl show' once for all units, which is way
+ # faster
+ unit=${units[i]}
+ prop=$(systemctl show --no-pager --property="$property" ${unit} 2>/dev/null)
+ if [[ "${prop}" = "$property=$value" ]]; then
+ echo "${unit}"
+ fi
+ done
+}
+
+_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read a b; do echo "$a"; done; }) )}
+_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read a b c d; do [[ $c == "inactive" ]] && echo "$a"; done; }) )}
+_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read a b; do echo "$a"; done; }) )}
+_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "enabled" ]] && echo "$a"; done; }) )}
+_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read a b; do [[ $b == "disabled" ]] && echo "$a"; done; }) )}
+_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "masked" ]] && echo "$a"; done; }) )}
+
+# Completion functions for ALL_UNITS
+for fun in is-active is-enabled status show mask preset ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_really_all_units
+ compadd "$@" -a - _sys_really_all_units
+ }
+done
+
+# Completion functions for ENABLED_UNITS
+for fun in disable reenable ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_enabled_units
+ compadd "$@" -a - _sys_enabled_units
+ }
+done
+
+# Completion functions for DISABLED_UNITS
+(( $+functions[_systemctl_enable] )) || _systemctl_enable()
+{
+ _systemctl_disabled_units
+ compadd "$@" -a - _sys_disabled_units
+}
+
+# Completion functions for FAILED_UNITS
+(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
+{
+ _systemctl_failed_units
+ compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
+}
+
+# Completion functions for STARTABLE_UNITS
+(( $+functions[_systemctl_start] )) || _systemctl_start()
+{
+ _systemctl_inactive_units
+ compadd "$@" -a - _sys_inactive_units
+}
+
+# Completion functions for STOPPABLE_UNITS
+for fun in stop kill try-restart condrestart ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_active_units
+ compadd "$@" - $( _filter_units_by_property CanStop yes \
+ ${_sys_active_units[*]} )
+ }
+done
+
+# Completion functions for ISOLATABLE_UNITS
+(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
+{
+ _systemctl_all_units
+ compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
+ ${_sys_all_units[*]} )
+}
+
+# Completion functions for RELOADABLE_UNITS
+for fun in reload reload-or-try-restart force-reload ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_active_units
+ compadd "$@" - $( _filter_units_by_property CanReload yes \
+ ${_sys_active_units[*]} )
+ }
+done
+
+# Completion functions for RESTARTABLE_UNITS
+for fun in restart reload-or-restart ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_all_units
+ compadd "$@" - $( _filter_units_by_property CanStart yes \
+ ${_sys_all_units[*]} | while read line; do \
+ [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo "$line"; \
+ done )
+ }
+done
+
+# Completion functions for MASKED_UNITS
+(( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
+{
+ _systemctl_masked_units
+ compadd "$@" -a - _sys_masked_units || _message "no masked unit found"
+}
+
+# Completion functions for JOBS
+(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
+{
+ compadd "$@" - $(__systemctl list-jobs \
+ | cut -d' ' -f1 2>/dev/null ) || _message "no job found"
+}
+
+# Completion functions for SNAPSHOTS
+(( $+functions[_systemctl_delete] )) || _systemctl_delete()
+{
+ compadd "$@" - $(__systemctl list-units --type snapshot --all \
+ | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found"
+}
+
+# Completion functions for ENVS
+for fun in set-environment unset-environment ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ local fun=$0 ; fun=${fun##_systemctl_}
+ local suf
+ if [[ "${fun}" = "set-environment" ]]; then
+ suf='-S='
+ fi
+
+ compadd "$@" ${suf} - $(systemctl show-environment \
+ | while read line; do echo "${line%%\=}";done )
+ }
+done
+
+(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
+
+# no systemctl completion for:
+# [STANDALONE]='daemon-reexec daemon-reload default dot dump
+# emergency exit halt kexec list-jobs list-units
+# list-unit-files poweroff reboot rescue show-environment'
+# [NAME]='snapshot load'
+
+_systemctl_caching_policy()
+{
+ local _sysunits
+ local -a oldcache
+
+ # rebuild if cache is more than a day old
+ oldcache=( "$1"(mh+1) )
+ (( $#oldcache )) && return 0
+
+ _sysunits=($(__systemctl --all | cut -d' ' -f1))
+
+ if (( $#_sysunits )); then
+ for unit in $_sysunits; do
+ [[ "$unit" -nt "$1" ]] && return 0
+ done
+ fi
+
+ return 1
+}
+
+
+
+_systemd_loginctl_all_sessions(){_sys_all_sessions=($(systemd-loginctl list-sessions | { while read a b; do echo "$a"; done; }) )}
+_systemd_loginctl_all_users() {_sys_all_users=( $(systemd-loginctl list-users | { while read a b; do echo "$a"; done; }) )}
+_systemd_loginctl_all_seats() {_sys_all_seats=( $(systemd-loginctl list-seats | { while read a b; do echo "$a"; done; }) )}
+
+# Completion functions for SESSIONS
+for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do
+ (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun()
+ {
+ _systemd_loginctl_all_sessions
+ compadd "$@" -a - _sys_all_sessions
+ }
+done
+
+# Completion functions for USERS
+for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do
+ (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun()
+ {
+ _systemd_loginctl_all_users
+ compadd "$@" -a - _sys_all_users
+ }
+done
+
+# Completion functions for SEATS
+(( $+functions[_systemd_loginctl_seats] )) || _systemd_loginctl_seats()
+{
+ _systemd_loginctl_all_seats
+ compadd "$@" -a - _sys_all_seats
+}
+for fun in seat-status show-seat terminate-seat ; do
+ (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun()
+ { _systemd_loginctl_seats }
+done
+
+# Completion functions for ATTACH
+(( $+functions[_systemd_loginctl_attach] )) || _systemd_loginctl_attach()
+{
+ _systemd_loginctl_all_seats
+
+ _arguments -w -C -S -s \
+ ':seat:_systemd_loginctl_seats' \
+ '*:device:_files'
+}
+
+# no systemd-loginctl completion for:
+# [STANDALONE]='list-sessions list-users list-seats flush-devices'
+
+(( $+functions[_systemd_loginctl_command] )) || _systemd_loginctl_command()
+{
+ local -a _systemd_loginctl_cmds
+ _systemd_loginctl_cmds=(
+ "list-sessions:List sessions"
+ "session-status:Show session status"
+ "show-session:Show properties of one or more sessions"
+ "activate:Activate a session"
+ "lock-session:Screen lock one or more sessions"
+ "unlock-session:Screen unlock one or more sessions"
+ "terminate-session:Terminate one or more sessions"
+ "kill-session:Send signal to processes of a session"
+ "list-users:List users"
+ "user-status:Show user status"
+ "show-user:Show properties of one or more users"
+ "enable-linger:Enable linger state of one or more users"
+ "disable-linger:Disable linger state of one or more users"
+ "terminate-user:Terminate all sessions of one or more users"
+ "kill-user:Send signal to processes of a user"
+ "list-seats:List seats"
+ "seat-status:Show seat status"
+ "show-seat:Show properties of one or more seats"
+ "attach:Attach one or more devices to a seat"
+ "flush-devices:Flush all device associations"
+ "terminate-seat:Terminate all sessions on one or more seats"
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'systemd-loginctl command' _systemd_loginctl_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+
+ cmd="${${_systemd_loginctl_cmds[(r)$words[1]:*]%%:*}}"
+
+ if (( $#cmd )); then
+ curcontext="${curcontext%:*:*}:systemd_loginctl-${cmd}:"
+
+ _call_function ret _systemd_loginctl_$cmd || _message 'no more arguments'
+ else
+ _message "unknown systemd-loginctl command: $words[1]"
+ fi
+ return ret
+ fi
+}
+
+_systemd "$@"
+
+# Local Variables:
+# mode: sh
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# sh-basic-offset: 2
+# End:
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 5fb721960..a8f133295 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -572,7 +572,7 @@ function _tmux-new-session() {
[[ -n ${tmux_describe} ]] && print "Create a new session" && return
local -a args
args=(
- '-d[attach the new session the current terminal]'
+ '-d[do not attach new session to current terminal]'
'-n[name the initial window]:window name'
'-s[name the session]:session name'
'-t[specify target session]:sessions:__tmux-sessions'
@@ -1097,7 +1097,7 @@ function __tmux-buffers() {
local -a bopts; bopts=()
fi
- buffers=( ${${(f)"$(command tmux list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
+ buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
_describe -t buffers 'buffers' buffers
}
@@ -1105,7 +1105,7 @@ function __tmux-bound-keys() {
local expl
local -a keys
- keys=( ${${${${(f)"$(command tmux list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
+ keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
_describe -t keys 'keys' keys
}
@@ -1124,7 +1124,7 @@ function __tmux-choose-stuff() {
function __tmux-clients() {
local expl
local -a clients
- clients=( ${${(f)"$(command tmux list-clients)"}/:[ $'\t']##/:} )
+ clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} )
_describe -t clients 'clients' clients
}
@@ -1400,7 +1400,7 @@ function __tmux-panes() {
opts=( )
fi
num=0
- command tmux list-panes "${opts[@]}" | while IFS= read -r line; do
+ command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do
panes+=( $(( num++ )):${line//:/} )
done
_describe -t panes 'panes' panes "$@"
@@ -1421,7 +1421,7 @@ function __tmux-server-options() {
function __tmux-sessions() {
local expl
local -a sessions
- sessions=( ${${(f)"$(command tmux list-sessions)"}/:[ $'\t']##/:} )
+ sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
_describe -t sessions 'sessions' sessions "$@"
}
@@ -1479,7 +1479,7 @@ function __tmux-windows() {
else
opts=( )
fi
- wins=( ${${(M)${(f)"$(command tmux list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
+ wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
_describe -t windows 'windows' wins "$@"
if [[ ${IPREFIX} != *: ]]; then
_wanted sessions expl 'sessions' __tmux-sessions -S:
@@ -1528,6 +1528,18 @@ function _tmux() {
if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}"
fi
+ if ! (( ${+functions[_tmux-$tmuxcommand]} )); then
+ local low high
+ low=$_tmux_commands[(i)$tmuxcommand*]
+ high=$_tmux_commands[(I)$tmuxcommand*]
+ if (( low == high )); then
+ tmuxcommand=${_tmux_commands[low]%%:*}
+ elif (( low < high )); then
+ _message -e "Ambiguous command $tmuxcommand"
+ else
+ _message -e "Subcommand $tmuxcommand not known"
+ fi
+ fi
curcontext="${curcontext%:*:*}:tmux-${tmuxcommand}:"
_call_function ret _tmux-${tmuxcommand}
fi
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index e54a08b27..51d640d62 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -54,7 +54,7 @@ _arguments -C -s \
'--no-cache[disallow server-cached data]' \
'(--html-extension -E)'{--html-extension,-E}'[save all HTML documents with a .html extension]' \
"--ignore-length[ignore \`Content-Length' header field]" \
- '--header=:string' \
+ '*--header=:string' \
'--proxy-user=:user' \
'--proxy-password=:password' \
'--referer=:URL:_urls' \
diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft
index a1f727442..ed5bfe7f7 100644
--- a/Completion/Unix/Command/_xmlsoft
+++ b/Completion/Unix/Command/_xmlsoft
@@ -41,8 +41,8 @@ case $service in
'--maxparserdepth[increase the maximum parser depth]:depth' \
'--html[input document is an HTML file]' \
'--encoding[the input document character encoding]:encoding:(${encoding[@]})' \
- '--param[pass a parameter,value pair]:name::value (xpath expression)' \
- '--stringparam[pass a parameter]:name::value' \
+ '*--param[pass a parameter,value pair]:name::value (xpath expression)' \
+ '*--stringparam[pass a parameter]:name::value' \
'--path[provide a set of paths for resources]:paths:_files -/' \
'--nonet[refuse to fetch DTDs or entities over network]' \
'--nowrite[refuse to write to any file or resource]' \
@@ -53,7 +53,7 @@ case $service in
'--xincludestyle[do XInclude processing on stylesheets]' \
'--load-trace[print trace of all external entites loaded]' \
{--profile,--norman}'[dump profiling information]' \
- '1:stylesheet:_files -g "*.xsl(-.)"' \
+ '1:stylesheet:_files -g "*.xslt#(-.)"' \
':file:_files -g "*.xml(-.)"' && return
;;
xmllint)
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index ff404278a..4cc24a59f 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -1,55 +1,100 @@
#compdef zfs
+# Synced with the S11U1 build 20 man page
_zfs() {
local context state line expl
typeset -A opt_args
- local -a subcmds rw_properties rw_propnames ro_properties
+ local -a subcmds rw_properties rw_propnames ro_properties create_properties
+ local -a difffields delegatable_perms
subcmds=(
"create" "destroy" "clone" "promote" "rename" "snapshot"
"rollback" "list" "set" "get" "inherit" "mount" "unmount"
"share" "unshare" "send" "receive" "allow" "unallow"
- "upgrade"
+ "upgrade" "userspace" "groupspace" "hold" "holds" "release"
+ "diff" "key" "help"
)
+ # TODO: userused@ and groupused@ could have more extensive handling
ro_properties=(
"name" "type" "creation" "used" "available" "referenced"
- "compressratio" "mounted" "origin"
+ "compressratio" "mounted" "origin" "usedbychildren"
+ "usedbydataset" "usedbyrefreservation" "usedbysnapshots"
+ "defer_destroy" "userused@" "userrefs" "groupused@"
+ "keychangedate" "keystatus" "rekeydate"
)
# TODO: Be cleverer about what values can be set. Is there any way to
# set the sorting for *size properties to false by default?
rw_properties=(
- "aclinherit:value:(discard noallow secure passthrough)"
- "aclmode:value:(discard groupmask passthrough)"
+ "aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
+ "aclmode:value:(discard mask passthrough)"
"atime:value:(on off)"
- "canmount:value:(on off)"
- "checksum:value:(on off fletcher2 fletcher4 sha256)"
- "compression:value:(on off lzjb gzip gzip-{1..9})"
+ "canmount:value:(on off noauto)"
+ "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
+ "compression:value:(on off lzjb gzip gzip-{1..9} zle)"
"copies:value:(1 2 3)"
+ "dedup:value:(on off verify sha256 sha256,verify)"
"devices:value:(on off)"
+ "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
"exec:value:(on off)"
- "mountpoint:value:{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
+ "groupquota@:value:" # TODO: complete group=size|none
+ "keysource:value:_zfs_keysource_props"
+ "logbias:value:(latency throughput)"
+ "mlslabel:value:(none)" # TODO: list sensitivity labels
+ "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
+ "multilevel:value:(on off)"
+ "nbmand:value:(on off)"
+ "primarycache:value:(all none metadata)"
"quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
"readonly:value:(on off)"
- "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)"
- "reservation:value:" # <size>, "none"
+ "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
+ "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
+ "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
+ "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
+ "rstchown:value:(on off)"
+ "secondarycache:value:(all none metadata)"
"setuid:value:(on off)"
- "shareiscsi:value:(on off)" # or "type=<type>"
- "sharenfs:value:(on off)" # or share(1M) options
+ "shadow:value:" # TODO: complete URI|none
+ "share:share properties:"
+ "sharenfs:value:(on off)"
+ "sharesmb:value:(on off)"
"snapdir:value:(hidden visible)"
- "version:value:(1 2 current)"
- "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)"
+ "sync:value:(standard always disabled)"
+ "userquota@:value:" # TODO: complete user=size|none
+ "version:value:(1 2 3 4 current)"
"volsize:value:" # <size>
+ "vscan:value:(on off)"
"xattr:value:(on off)"
"zoned:value:(on off)"
)
+ create_properties=(
+ $rw_properties
+ "casesensitivity:value:(sensitive insensitive mixed)"
+ "normalization:value:(none formC formD formKC formKD)"
+ "utf8only:value:(on off)"
+ "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
+ )
+
+ delegatable_perms=(
+ "allow" "clone" "create" "destroy" "diff" "hold" "key"
+ "keychange" "mount" "promote" "receive" "release" "rename"
+ "rollback" "send" "share" "snapshot"
+ "groupused" "userused" "userprop"
+ ${create_properties%%:*}
+ )
+
rw_propnames=( ${rw_properties%%:*} )
+ difffields=(
+ object parent size links linkschange name oldname user group
+ ctime mtime atime crtime
+ )
+
if [[ $service == "zfs" ]]; then
_arguments -C -A "-*" \
- '-\?[help]' \
+ '-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -63,124 +108,143 @@ _zfs() {
case $service in
("create")
_arguments -A "-*" \
- '-p[create parent datasets]' \
- '-o[set initial properties]:property:_values -s , "property" $rw_properties' \
+ '-p[Create parent datasets]' \
+ '-o[Set initial properties]:property:_values -s , "property" $create_properties' \
- set1 \
- ':filesystem:' \
+ ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
- set2 \
- '-s[create sparse volume]' \
- '-b[set volblocksize]:blocksize:' \
- '-V[set size]:size:' \
- ':volume:'
+ '-s[Create sparse volume]' \
+ '-b[Set volblocksize]:blocksize:' \
+ '-V[Set size]:size:' \
+ ':volume:_zfs_dataset -t fs -e "parent dataset"'
;;
("destroy")
_arguments -A "-*" \
- '-r[recursively destroy all children]' \
- '-R[recursively destroy all dependents]' \
- '-f[force unmounts]' \
- ':filesystem/volume/snapshot:_zfs_dataset'
+ '-r[Recursively destroy all children]' \
+ '-R[Recursively destroy all dependents]' \
+ - set1 \
+ '-d[delete or mark deferred]' \
+ ':snapshot:_zfs_dataset -t snap' \
+ - set2 \
+ '-f[Force unmounts]' \
+ ':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol'
;;
("snapshot")
_arguments -A "-*" \
- '-r[recursively snapshot all descendant datasets]' \
+ '-r[Recursively snapshot all descendant datasets]' \
+ '-o[Set property]:property:_values -s , "property" $create_properties' \
':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
;;
("rollback")
_arguments -A "-*" \
- '-r[recursively destroy more recent snapshots]' \
- '-R[recursively destroy more recent snapshots and clones]' \
- '-f[force unmounts]' \
+ '-r[Recursively destroy more recent snapshots]' \
+ '-R[Recursively destroy more recent snapshots and clones]' \
+ '-f[Force unmounts]' \
':snapshot:_zfs_dataset -t snap'
;;
("clone")
# XXX needs to bail if there are no snapshots
_arguments -A "-*" \
- '-p[create parent datasets]' \
+ '-p[Create parent datasets]' \
+ '-K[Create encryption key]' \
+ '-o[Set property]:property:_values -s , "property" $create_properties' \
':snapshot:_zfs_dataset -t snap' \
- ':filesystem/volume:'
+ ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
;;
("promote")
- # XXX complete only cloned filesystems
_arguments \
- ':filesystem:_zfs_dataset -t fs' \
+ ':filesystem:_zfs_dataset -t clone' \
;;
("rename")
_arguments -A "-*" \
- - set1 \
- '-p[create parent datasets]' \
- ':filesystem/volume/snapshot:_zfs_dataset' \
- ':filesystem/volume/snapshot:' \
- - set2 \
- '-r[recursively rename snapshots of all descendent datasets]' \
- ':snapshot:_zfs_dataset -t snap' \
- ':snapshot:'
+ '(-r)-p[Create parent datasets]' \
+ '(-p)-r[Recursively rename snapshots of all descendent datasets]' \
+ ':dataset:_zfs_dataset -r1' \
+ ':dataset:_zfs_dataset -r2'
;;
("list")
_arguments -A "-*" \
- '-r[recursively display children]' \
- '-H[scripting mode]' \
- '-o[properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
- '*-s[sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
- '*-S[sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
- '-t[dataset types to list]:dataset type:_values -s , "dataset type" filesystem snapshot volume' \
- '*:filesystem/volume/snapshot:_zfs_dataset'
+ '-r[Recursively display children]' \
+ '-H[Scripting mode]' \
+ '-d[Depth]:value:' \
+ '-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
+ '*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
+ '*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
+ '-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \
+ '*:filesystem/volume/snapshot/path:_zfs_dataset -p'
;;
("set")
_arguments \
+ '-r[Recursively apply value]' \
':property:_values -s , "property" $rw_properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("get")
_arguments -A "-*" \
- "-r[recursively display children's properties]" \
- '-H[scripting mode]' \
- '-p[display numbers exactly]' \
- '-s[specify sources]:source:_values -s , "source" local default inherited temporary none' \
- '-o[specify fields]:field:_values -s , "field" name property value source' \
+ "-r[Recursively display children's properties]" \
+ '-d[Depth]:value:' \
+ '-H[Scripting mode]' \
+ '-p[Display numbers exactly]' \
+ '-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \
+ '-o[Specify fields]:field:_values -s , "field" name property value source' \
':property:_values -s , "property" $ro_properties $rw_propnames all' \
'*:filesystem/volume/snapshot:_zfs_dataset'
;;
("inherit")
_arguments -A "-*" \
- '-r[recursively inherit property for all children]' \
+ '-r[Recursively inherit property for all children]' \
+ '-S[Revert to received property value]' \
':property:_values -s , "property" $ro_properties $rw_properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol'
;;
+ ("userspace"|"groupspace")
+ _arguments -A "-*" \
+ '-n[Print numeric ID]' \
+ '-i[Translate SID to POSIX ID]' \
+ '-H[Tab-delimited output with no headers]' \
+ '-p[Parseable mode]' \
+ '-o[Properties to list]:property:_values -s , "property" type name used quota' \
+ '*-s[Sort key (ascending)]:property:_values "property" type name used quota' \
+ '*-S[Sort key (descending)]:property:_values "property" type name used quota' \
+ '-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
+ '*:filesystem/volume/snapshot:_zfs_dataset'
+ ;;
+
("mount")
_arguments -A "-*" \
- '-o[mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
- '-O[overlay mount]' \
- '-v[report mount progress]' \
+ '-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
+ '-O[Overlay mount]' \
+ '-v[Report mount progress]' \
- set1 \
':filesystem:_zfs_dataset -t fs' \
- set2 \
- '-a[mount all available ZFS filesystems]'
+ '-a[Mount all available ZFS filesystems]'
;;
("unmount")
_arguments -A "-*" \
- set1 \
- '-f[force unmount]' \
+ '-f[Force unmount]' \
':filesystem:_zfs_dataset -t fs -t mtpt' \
- set2 \
- '-a[unmount all ZFS filesystems]'
+ '-a[Unmount all ZFS filesystems]'
;;
("share")
_arguments -A "-*" \
- set1 \
- '-a[share all available ZFS filesystems]' \
+ '-a[Share all available ZFS filesystems]' \
- set2 \
':filesystem:_zfs_dataset -t fs'
;;
@@ -188,45 +252,165 @@ _zfs() {
("unshare")
_arguments -A "-*" \
- set1 \
- '-a[unshare all shared ZFS filesystems]' \
+ '-a[Unshare all shared ZFS filesystems]' \
- set2 \
- '-F[force unshare]' \
':filesystem:_zfs_dataset -t fs -t mtpt'
;;
("send")
_arguments -A "-*" \
- '-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
+ '-b' \
+ '-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
+ '-D[Perform dedup processing]' \
+ '-p[Send properties]' \
+ '-v[Verbose]' \
+ - set1 \
+ '-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
+ '-R[Generate a replication stream package]' \
+ ':snapshot:_zfs_dataset -t snap' \
+ - set2 \
+ '-c[Create a self-contained stream]' \
+ '-r[Generate a recursive stream package]' \
':snapshot:_zfs_dataset -t snap'
;;
("receive")
_arguments -A "-*" \
- '-v[verbose]' \
- '-n[do not receive the stream]' \
- '-F[force a rollback if necessary]' \
+ '-v[Verbose]' \
+ '-n[Do not receive the stream]' \
+ '-F[Force a rollback if necessary]' \
+ '-u[Filesystem is not mounted]' \
+ '-o[Include property change in the stream]::' \
+ '-x[Exclude property change from the stream]:property:' \
- set1 \
':filesystem/volume/snapshot:_zfs_dataset' \
- set2 \
- '-d[set path prefix]:filesystem:_zfs_dataset -t fs'
+ '(-e)-d[Set path prefix from stream, excluding only pool name]' \
+ '(-d)-e[Set path prefix from stream, using last path element]' \
+ '-:filesystem:_zfs_dataset -t fs'
;;
- ("allow"|"unallow")
- _message "unimplemented zfs subcommand: $service"
+ ("allow")
+ _arguments -A "-*" \
+ - set1 \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set2 \
+ '(-g)-u[User]:user:_users' \
+ '(-u)-g[Group]:group:_groups' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set3 \
+ '-e[Everyone]' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set4 \
+ '-c[Create-time permissions]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set5 \
+ '-s[Define or modify permission sets]' \
+ ':setname:' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ ("unallow")
+ _arguments -A "-*" \
+ '-r[Recursive removal]' \
+ - set1 \
+ '-s[Remove permissions from or delete a permission set]:permission set:' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set2 \
+ '(-g)-u[User]:user:_users' \
+ '(-u)-g[Group]:group:_groups' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set3 \
+ '-e[Everyone]' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set4 \
+ '-c[Create-time permissions]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("upgrade")
_arguments -A "-*" \
- set1 \
- '-v[verbose]' \
+ '-v[Verbose]' \
- set2 \
- '-a[upgrade all filesystems on all pools]' \
- '-r[upgrade descendent filesystems, too]' \
- '-V[upgrade to specified version]:version:(1 2)' \
+ '-a[Upgrade all filesystems on all pools]' \
+ '-r[Upgrade descendent filesystems, too]' \
+ '-V[Upgrade to specified version]:version:(1 2)' \
- set3 \
- '-r[upgrade descendent filesystems, too]' \
- '-V[upgrade to specified version]:version:(1 2)' \
- ':filesystem:_zfs_dataset -t fs' \
+ '-r[Upgrade descendent filesystems, too]' \
+ '-V[Upgrade to specified version]:version:(1 2)' \
+ ':filesystem:_zfs_dataset -t fs'
+ ;;
+
+ ("hold")
+ _arguments -A "-*" \
+ '-r[Apply hold recursively]' \
+ ':tag:' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ ("holds")
+ _arguments -A "-*" \
+ '-r[List holds recursively]' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ ("release")
+ _arguments -A "-*" \
+ '-r[Release holds recursively]' \
+ ':tag:' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ ("diff")
+ _arguments -A "-*" \
+ '-F[Add column for filetype character]' \
+ '-H[Parseable output]' \
+ '-e[Only show new and changed files]' \
+ '*-o[Show fields]:field:_values "field" $difffields' \
+ '-t[Add column for ctime]' \
+ - set1 \
+ ':snapshot:_zfs_dataset -t snap' \
+ ':snapshot or filesystem:_zfs_dataset -t snap -t fs' \
+ - set2 \
+ '-E[Show difference from empty]' \
+ ':snapshot or filesystem:_zfs_dataset -t snap -t fs'
+ ;;
+
+ ("key")
+ _arguments -A "-*" \
+ - set1 \
+ '-a[Apply to all datasets in all pools]' \
+ '(-u -K -f)-l[Load the encryption key]' \
+ '(-l -K)-u[Unload the encryption key]' \
+ '(-l -u -f)-K[Create a new data encryption key]' \
+ '(-l -K)-f[Unmount the dataset before unloading the encryption key]' \
+ '-r[Apply recursively]' \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol' \
+ - set2 \
+ '-c[Change the encryption key]' \
+ '-o[Change a property]:property:_zfs_keysource_props' \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ ("help")
+ compadd property $subcmds $ro_properties ${rw_properties%%:*}
;;
(*)
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
index 9692121ae..0af2ab32d 100644
--- a/Completion/Unix/Command/_zpool
+++ b/Completion/Unix/Command/_zpool
@@ -1,41 +1,91 @@
#compdef zpool
+# Synced with the S11U1 build 19 man page
_zpool() {
- local -a subcmds fields
+ local context state line expl
+ local -a subcmds fields ro_props rw_props versions create_properties_dataset
subcmds=(
- create destroy add remove list iostat status online
- offline clear attach detach replace scrub import export
- upgrade history get set
+ create destroy add remove list iostat status online
+ offline clear attach detach replace scrub import export
+ upgrade history get set split
)
- fields=(
- name\:"Pool name" size\:"Total size" used\:"Space used"
- available\:"Space available" capacity\:"Space used (percentage)"
- health\:"Health status"
+ versions=(
+ ${${${(M)"${(f)$(zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*}
)
- properties=(
- "bootfs:value:"
- "autoreplace:value:(on off)"
- "delegation:value:(on off)"
+ ro_props=(
+ "all[All properties]"
+ "allocated[Space allocated]"
+ "capacity[Space used (percentage)]"
+ "dedupratio[Deduplication ratio]"
+ "free[Space unallocated]"
+ "guid[Unique identifier]"
+ "health[Health status]"
+ "size[Total size]"
)
- propnames=( ${properties%%:*} )
-
- import_properties=(
- xattr
- copies
- shareiscsi
- canmount
- share
- sharenfs
- userprop
- mount
+
+ rw_props=(
+ "altroot[Alternate root directory]:value:"
+ "autoexpand[Automatic pool expansion]:value:(on off)"
+ "autoreplace[Automatic device replacement]:value:(on off)"
+ "bootfs[Default bootable dataset]:value:"
+ "cachefile[Pool configuration cache file location]:value:"
+ "dedupditto[Threshold for number of copies]:value:"
+ "delegation[Delegated administration]:value:(on off)"
+ "failmode[Failure-mode behavior]:value:(wait continue panic)"
+ "listsnaps[Show snapshots in 'zfs list']:value:(on off)"
+ "version[Pool version]:version:($versions)"
+ )
+
+ fields=( ${ro_props%%:*} ${rw_props%%:*} )
+
+ create_properties_dataset=(
+ "aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
+ "aclmode:value:(discard mask passthrough)"
+ "atime:value:(on off)"
+ "canmount:value:(on off noauto)"
+ "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
+ "compression:value:(on off lzjb gzip gzip-{1..9} zle)"
+ "copies:value:(1 2 3)"
+ "dedup:value:(on off verify sha256 sha256,verify)"
+ "devices:value:(on off)"
+ "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
+ "exec:value:(on off)"
+ "groupquota@:value:" # TODO: complete group=size|none
+ "keysource:value:_zfs_keysource_props"
+ "logbias:value:(latency throughput)"
+ "mlslabel:value:(none)" # TODO: list sensitivity labels
+ "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
+ "nbmand:value:(on off)"
+ "primarycache:value:(all none metadata)"
+ "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
+ "readonly:value:(on off)"
+ "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
+ "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
+ "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
+ "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
+ "rstchown:value:(on off)"
+ "secondarycache:value:(all none metadata)"
+ "setuid:value:(on off)"
+ "shadow:value:" # TODO: complete URI|none
+ "share:share properties:"
+ "sharenfs:value:(on off)"
+ "sharesmb:value:(on off)"
+ "snapdir:value:(hidden visible)"
+ "sync:value:(standard always disabled)"
+ "userquota@:value:" # TODO: complete user=size|none
+ "version:value:(1 2 3 4 current)"
+ "volsize:value:" # <size>
+ "vscan:value:(on off)"
+ "xattr:value:(on off)"
+ "zoned:value:(on off)"
)
if [[ $service == "zpool" ]]; then
_arguments -C -A "-*" \
- '-\?[help]' \
+ '-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -48,7 +98,9 @@ _zpool() {
case $service in
(clear)
- _arguments \
+ _arguments -A "-*" \
+ '-F[Discard transactions to allow pool opening]' \
+ '-n[With -F, check if discarding transactions would work]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
@@ -56,38 +108,46 @@ _zpool() {
(create)
# TODO: investigate better vdev handling
_arguments -A "-*" \
- '-f[force use of in-use devices]' \
- '-n[display configuration without creating pool]' \
- '-R[use alternate root]:alternate root:_files -/' \
- '-m[set mountpoint for root dataset]:mountpoint:' \
+ '-B[Create EFI boot partition on whole disks]' \
+ '-o[Set pool property at creation time]:property:_values -s , "property" $rw_props' \
+ '-O[Set dataset property at creation time]:property:_values -s , "property" $create_properties_dataset' \
+ '-f[Force use of in-use devices]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-n[Display configuration without creating pool]' \
+ '-R[Use alternate root]:alternate root:_files -/' \
+ '-m[Set mountpoint for root dataset]:mountpoint:' \
':pool name:' \
'*:virtual device:_files'
;;
(destroy)
_arguments -A "-*" \
- '-f[force active datasets to be unmounted]' \
+ '-f[Force active datasets to be unmounted]' \
':pool name:_zfs_pool'
;;
(add)
_arguments -A "-*" \
- '-f[force use of in-use devices]' \
- '-n[display configuration without modifying pool]' \
+ '-f[Force use of in-use devices]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-n[Display configuration without modifying pool]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
(list)
_arguments \
- '-H[scripted mode]' \
- '-o[fields to list]:field:_values -s , "field" ${^fields/\:/[}\]' \
+ '-H[Scripted mode]' \
+ '-T[timestamp]:value:(u d)' \
+ '-o[Fields to list]:field:_values -s , "field" $fields' \
'::pool name:_zfs_pool'
;;
(iostat)
_arguments -A "-*" \
- '-v[verbose statistics]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-T[timestamp]:value:(u d)' \
+ '-v[Verbose statistics]' \
'*::pool name:_zfs_pool' \
'::interval:' \
'::count:'
@@ -95,20 +155,23 @@ _zpool() {
(status)
_arguments -A "-*" \
- '-v[verbose information]' \
- '-x[show only unhealthy pools]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-v[Verbose information]' \
+ '-x[Show only unhealthy pools]' \
+ '-T[timestamp]:value:(u d)' \
'*::pool name:_zfs_pool'
;;
(offline)
_arguments -A "-*" \
- '-t[offline until next reboot]' \
+ '-t[Offline until next reboot]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
(online)
_arguments \
+ '-e[Expand device to use all available space]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
@@ -116,7 +179,7 @@ _zpool() {
(attach)
# TODO: first device should choose first from existing.
_arguments \
- '-f[force attach, even if in use]' \
+ '-f[Force attach, even if in use]' \
':pool name:_zfs_pool' \
':virtual device:_files' \
':virtual device:_files'
@@ -130,7 +193,7 @@ _zpool() {
(replace)
_arguments -A "-*" \
- '-f[force attach, even if in use]' \
+ '-f[Force attach, even if in use]' \
':pool name:_zfs_pool' \
':virtual device:_files' \
'::virtual device:_files'
@@ -138,57 +201,72 @@ _zpool() {
(scrub)
_arguments -A "-*" \
- '-s[stop scrubbing]' \
+ '-s[Stop scrubbing]' \
'*:pool name:_zfs_pool'
;;
(export)
_arguments -A "-*" \
- '-f[forcefully unmount all datasets]' \
+ '-f[Forcefully unmount all datasets]' \
'*:pool name:_zfs_pool'
;;
(import)
- # TODO: -o should complete options
+ # TODO: -o should complete mount options, too
_arguments -A "-*" \
- '*-d[search for devices or files in directory]:_files -/' \
- '-D[destroyed pools]' \
- '-f[force import]' \
+ '-D[Destroyed pools]' \
+ '(-d)*-c[Use cache file]:cache file:_files' \
+ '(-c)*-d[Search for devices or files in directory]:directory:_files -/' \
+ '-f[Force import]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-m[Ignore missing log devices]' \
+ '-R[Alternate root]:alternate root:_files -/' \
+ '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
- set1 \
- '-o[mount options]' \
- '-p[set property]:property:_values -s , "property" $import_properties' \
- '-R[alternate root]:_files -/' \
'*:pool name or id:_zfs_pool' \
'::new pool name:' \
- set2 \
- '-a[all pools]'
+ '-N[Do not mount any filesystems]' \
+ '-a[All pools]'
;;
(get)
_arguments -A "-*" \
- ':property:_values -s , "property" $propnames all' \
+ ':property:_values -s , "property" $fields' \
'*:pool name:_zfs_pool'
;;
(set)
_arguments -A "-*" \
- ':property:_values -s , "property" $properties' \
+ ':property:_values -s , "property" $rw_props' \
'*:pool name:_zfs_pool'
;;
+ (split)
+ _arguments -A "-*" \
+ '-R[Alternate root]:alternate root:_files -/' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-n[Display configuration without splitting]' \
+ '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
+ ':pool name or id:_zfs_pool' \
+ ':new pool name:' \
+ '*::virtual device:_files -/'
+ ;;
+
(upgrade)
_arguments -A "-*" \
- set1 \
- '-v[display ZFS versions and descriptions]' \
+ '-v[Display ZFS versions and descriptions]' \
- set2 \
- '-a[upgrade all pools]' \
+ "-V[Upgrade to given version]:version:($versions)" \
+ '-a[Upgrade all pools]' \
'*:pool name:_zfs_pool'
;;
(history)
_arguments -A "-*" \
- '-i[display internal events]' \
- '-l[long format]' \
+ '-i[Display internal events]' \
+ '-l[Long format]' \
'*:pool name:_zfs_pool'
;;
diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles
index 4c0d688ac..4b5102191 100644
--- a/Completion/Unix/Type/.distfiles
+++ b/Completion/Unix/Type/.distfiles
@@ -36,6 +36,7 @@ _pids
_ports
_printers
_ps
+_ps1234
_pspdf
_services
_signals
@@ -49,5 +50,6 @@ _user_at_host
_users
_users_on
_zfs_dataset
+_zfs_keysource_props
_zfs_pool
'
diff --git a/Completion/Unix/Type/_pdf b/Completion/Unix/Type/_pdf
index a2601997b..f20f94e79 100644
--- a/Completion/Unix/Type/_pdf
+++ b/Completion/Unix/Type/_pdf
@@ -1,4 +1,4 @@
-#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv
+#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv evince epdfview
local expl ext=''
diff --git a/Completion/Unix/Type/_ps1234 b/Completion/Unix/Type/_ps1234
new file mode 100644
index 000000000..13c90b50c
--- /dev/null
+++ b/Completion/Unix/Type/_ps1234
@@ -0,0 +1,109 @@
+#compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default-
+
+local -a specs
+local expl paren
+
+if [[ -n $compstate[quote] ]]; then
+ paren='('
+else
+ paren='\('
+fi
+
+if [[ $PREFIX == *%(-|)<-># ]]; then
+ specs=(
+ 'm:hostname up to first .'
+ '_:status of parser'
+ 'd:current working directory'
+ '/:current working directory'
+ '~:current working directory, with ~ replacement'
+ 'N:name of current script or shell function'
+ 'x:name of file containing code being executed'
+ 'c:deprecated'
+ '.:deprecated'
+ 'C:deprecated'
+ 'F:start using fg color'
+ 'K:start using bg color'
+ 'G:counts as extra character inside %{...%}'
+ )
+ if [[ $PREFIX == *% ]]; then
+ if [[ $service == -value-,SPROMPT,* ]]; then
+ specs+=(
+ 'r:suggested correction'
+ 'R:corrected string'
+ )
+ fi
+ specs+=(
+ '%:A %'
+ '):A )'
+ 'l:current line (tty) with /dev/tty stripped'
+ 'M:full hostname'
+ 'n:username'
+ 'y:current line (tty)'
+ '#:a # when root, % otherwise'
+ '?:return status of last command'
+ 'h:current history event number'
+ '!:current history event number'
+ 'i:current line number'
+ 'I:current source line number'
+ 'j:number of jobs'
+ 'L:$SHLVL'
+ 'D:date in yy-mm-dd format'
+ 'T:current time of day, 24-hour format'
+ 't:current time of day, 12-hour am/pm format'
+ '@:current time of day, 12-hour am/pm format'
+ '*:current time of day, 24-hour format with seconds'
+ 'w:the date in day-dd format'
+ 'W:the date in mm/dd/yy format'
+ 'D{}:format string like strftime'
+ 'B:start bold'
+ 'b:stop bold'
+ 'E:clear to end of line'
+ 'U:start underline'
+ 'u:stop underline'
+ 'S:start standout'
+ 's:stop standout'
+ 'f:reset fg color'
+ 'k:reset bg color'
+ '{:start literal escape sequence'
+ '}:stop literal escape sequence'
+ 'v:value from $psvar array'
+ '(:ternary expression %(x.true-string.false-string)'
+ '<<:truncation from left %len<string<'
+ '>>:truncation from right %len>string>'
+ '[]:truncation from who knows where'
+ )
+ fi
+ compset -P "*"
+ _describe -t prompt-format-specifier 'prompt format specifier' specs -S ''
+ _message -e prompt-format-specifier number
+elif [[ $PREFIX == *%$paren(-|)<-># ]]; then
+ specs=(
+ '!:running with privileges'
+ '#:effective uid'
+ '?:exit status'
+ '_:at least n shell constructs started'
+ 'C:at least n path elements'
+ '/:at least n path elements'
+ '.:at least n path elements'
+ 'c:at least n path elements'
+ '~:at least n path elements'
+ 'D:month'
+ 'd:day of month'
+ 'g:effective gid'
+ 'j:number of jobs'
+ 'L:SHLVL'
+ 'l:number of characters already printed'
+ 'S:SECONDS parameter at least n'
+ 'T:current hour'
+ 't:current minute'
+ 'v:psvar has at least n elements'
+ 'V:element n of psvar is set and non-empty'
+ 'w:day of week (Sunday = 0)'
+ )
+ compset -P "*"
+ _describe -t ternary-prompt-expression 'ternary prompt format test character' specs -S ''
+ _message -e ternary-prompt-expression number
+else
+ _describe -t prompt-format-specifier 'prompt format specifier' '(%)' -S ''
+ _default "$@"
+fi
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 1840fb413..d862011ac 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -1,15 +1,64 @@
#autoload
-local -a type typearg list
+local -a type expl_type_arr rsrc rdst paths_allowed
+local -a typearg datasetlist expl mlist
+local expl_type
-zparseopts -D -E -a type t+:
+# -e takes an argument which is passed as as the "descr" argument to _wanted
+# -p indicates that filesystem paths, not just dataset names, are allowed
+# -r1 indicates that we're completing the source of a rename
+# -r2 indicates that we're completing the destination of a rename
+# -t takes arguments (what kinds of datasets) and can appear multiple times
+zparseopts -D -E e:=expl_type_arr p=paths_allowed r1=rsrc r2=rdst t+:=type
-[[ -n $type[(r)fs] ]] && typearg=( filesystem )
-[[ -n $type[(r)vol] ]] && typearg=( $typearg volume )
-[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot )
-[[ -n $typearg ]] && typearg=( -t ${(j:,:)typearg} )
+[[ -n $type[(r)fs] ]] && typearg=( filesystem )
+[[ -n $type[(r)vol] ]] && typearg=( $typearg volume )
+[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot )
+if [[ -n $typearg ]]; then
+ typearg=( -t ${(j:,:)typearg} )
+# We know we're in zfs list if paths_allowed is non-empty.
+elif [[ -n $opt_args[-t] && ${#paths_allowed} -gt 0 ]]; then
+ typearg=( -t $opt_args[-t] )
+fi
+
+if [[ ${#paths_allowed} -gt 0 && $PREFIX == /* ]]; then
+ _path_files
+ return
+fi
+
+if [[ ${#rsrc} -gt 0 ]]; then
+ # With the -r option to zfs rename, we can only rename snapshots. With the
+ # -p option, we can only rename filesystems and volumes.
+ if [[ -n $words[(r)-r] ]]; then
+ typearg=( -t snapshot )
+ elif [[ -n $words[(r)-p] ]]; then
+ typearg=( -t filesystem,volume )
+ else
+ typearg=( -t filesystem,snapshot,volume )
+ fi
+fi
-datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} )
+if [[ ${#rdst} -gt 0 ]]; then
+ if [[ ${words[CURRENT - 1]} == *@* ]]; then
+ # If we're renaming snapshots, there's nothing to complete, so
+ # we simply give instructions. (In non-recursive cases, we
+ # could put the name of the snapshotted dataset first, but why
+ # bother with the long form?)
+ _message -e 'snapshot name (beginning with "@")'
+ return
+ else
+ # The parent dataset must be a filesystem, and can't rename
+ # a dataset into another pool. Plus we hardcode the expl.
+ typearg=( -t fs -r ${${words[CURRENT - 1]}%%/*} )
+ expl_type_arr=( -e "parent dataset" )
+ fi
+fi
+
+if [[ -n $type[(r)clone] ]]; then
+ datasetlist=( ${="$(zfs list -H -o name,origin -t fs | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
+else
+ datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} )
+fi
expl_type=${typearg[2,-1]//,/\/}
if [[ -n $type[(r)mtpt] ]]; then
@@ -18,5 +67,8 @@ if [[ -n $type[(r)mtpt] ]]; then
expl_type="$expl_type/mountpoint"
fi
-# compadd "$@" - $list
-_wanted dataset expl "$expl_type" _multi_parts "$@" / datasetlist
+if [[ -n $expl_type_arr[2] ]]; then
+ expl_type=$expl_type_arr[2]
+fi
+
+_wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist
diff --git a/Completion/Unix/Type/_zfs_keysource_props b/Completion/Unix/Type/_zfs_keysource_props
new file mode 100644
index 000000000..01f63257a
--- /dev/null
+++ b/Completion/Unix/Type/_zfs_keysource_props
@@ -0,0 +1,15 @@
+#autoload
+
+local -a suf
+local expl
+
+compset -S ",*" || suf=(-S ,)
+if compset -P 1 "*,"; then
+ _alternative "zfs-keylocator-prompt:\"prompt\" locator:(prompt)" \
+ "zfs-keylocator-file:file locator:_path_files" \
+ "zfs-keylocator-pkcs11:PKCS#11 locator: " \
+ "zfs-keylocator-https:HTTPS URL locator: "
+else
+ _description format expl "keysource format"
+ compadd $suf -q "$expl[@]" "$@" raw hex passphrase
+fi
diff --git a/Completion/Zsh/Command/_print b/Completion/Zsh/Command/_print
index af0501b7a..405393355 100644
--- a/Completion/Zsh/Command/_print
+++ b/Completion/Zsh/Command/_print
@@ -1,32 +1,84 @@
-#compdef print
-
-local state expl line eflag pflag
-
-# -e flag available only after -R
-eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}"
-
-# -p flag only relevant if we have a coprocess
-(:>&p) 2>/dev/null &&
- pflag='(-s -u -z)-p[print arguments to input of coprocess]'
-
-_arguments -C -s -A "-*" -S \
- '(-f)-r[ignore escape conventions of echo]' \
- '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \
- '-b[recognise bindkey escape sequences]' \
- '-m[remove arguments matching specified pattern]' \
- '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format' \
- '(-u -p -z)-s[place results in the history list]' \
- '(-c -f)-n[do not add a newline to the result]' \
- '(-N -c -f)-l[print arguments separated by newlines]' \
- '(-n -l -c -f)-N[print arguments separated and terminated by nulls]' \
- '(-O)-o[sort arguments in ascending order]' \
- '(-o)-O[sort arguments in descending order]' \
- '-i[case-insensitive sorting]' \
- '(-n -l -N -f -s -z)-a[with -c/-C, print arguments across before down]' \
- '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \
- '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \
- '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \
- '(-s -p -u)-z[push arguments onto editing buffer stack]' \
- '-D[substitute any arguments which are named directories using ~ notation]' \
- '-P[perform prompt expansion]' \
- $pflag $eflag '*:default:_default'
+#compdef print printf
+
+local state expl line eflag pflag rest ret=1
+
+if [[ $service = print ]]; then
+ # -e flag available only after -R
+ eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}"
+
+ # -p flag only relevant if we have a coprocess
+ (:>&p) 2>/dev/null &&
+ pflag='(-s -u -z)-p[print arguments to input of coprocess]'
+
+ if [[ -n ${words[1,CURRENT][(r)-*P*]} ]]; then
+ rest='*: :_ps1234'
+ else
+ rest='*: :_default'
+ fi
+
+ _arguments -C -s -A "-*" -S \
+ '(-f)-r[ignore escape conventions of echo]' \
+ '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \
+ '-b[recognise bindkey escape sequences]' \
+ '-m[remove arguments matching specified pattern]' \
+ '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format:->printfformat' \
+ '(-u -p -z)-s[place results in the history list]' \
+ '(-c -f)-n[do not add a newline to the result]' \
+ '(-N -c -f)-l[print arguments separated by newlines]' \
+ '(-n -l -c -f)-N[print arguments separated and terminated by nulls]' \
+ '(-O)-o[sort arguments in ascending order]' \
+ '(-o)-O[sort arguments in descending order]' \
+ '-i[case-insensitive sorting]' \
+ '(-n -l -N -f -s -z)-a[with -c/-C, print arguments across before down]' \
+ '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \
+ '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \
+ '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \
+ '(-s -p -u)-z[push arguments onto editing buffer stack]' \
+ '-D[substitute any arguments which are named directories using ~ notation]' \
+ '-P[perform prompt expansion]' \
+ $pflag $eflag $rest && ret=0
+elif [[ $service = printf ]]; then
+ state=printf
+fi
+
+if [[ $state = printf ]]; then
+ _arguments -C -s -S \
+ '1:format:->printfformat' \
+ '*: :_default' && ret=0
+fi
+
+if [[ $state = printfformat ]]; then
+ if [[ ${(Q)PREFIX} = *%((-|)<->|[-#0 +*.])# ]]; then
+ local -a specs
+ specs=(
+ '#:alternate form'
+ '0:zeropad to length n'
+ '-:left adjust result'
+ ' :leave one space in front of positive number from signed conversion'
+ '+:always place sign before a number from signed conversion'
+ '*:field width in next argument'
+ '.:precision'
+ 'c:print the first character of the argument'
+ 's:print the argument as a string'
+ {d,i}':signed decimal number or with leading " numeric value of following character'
+ 'o:unsigned octal number'
+ 'u:unsigned decimal number'
+ {x,X}':unsigned hexadecimal number, letters capitalized as x'
+ {e,E}':double number in scientific notation'
+ 'f:double number'
+ {g,G}':double number as %f or %e depending on size'
+ '%:a percent sign'
+ 'n:store number of printed bytes in parameter specified by argument'
+ 'b:as %s but interpret escape sequences in argument'
+ 'q:as %s but shell quote result'
+ )
+ compset -P "*"
+ _describe -t print-format-specifier 'print format specifier' specs -S ''
+ _message -e print-format-specifier 'number'
+ else
+ _describe -t print-format-specifier 'print format specifier' '(%)' -S ''
+ fi
+ ret=0
+fi
+
+return ret
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index 9c9165563..d44783d64 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -75,9 +75,11 @@ if [[ "$state" = vars_eq ]]; then
if (( $+opt_args[-w] ));then
_wanted files expl 'zwc file' _files -g '*.zwc(-.)'
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
- args=(${^fpath}/*(:t))
+ args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
- args=(${args:#(${(kj.|.)~functions})})
+ local -a funckeys
+ funckeys=(${(k)functions})
+ args=(${args:|funckeys})
_wanted functions expl 'shell function' compadd -a args
else
_functions
diff --git a/Completion/compinit b/Completion/compinit
index 489d662c3..7b8a34619 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -326,7 +326,7 @@ compdef() {
[[ $2 = .menu-select ]] && zmodload -i zsh/complist
zle -C "$1" "$2" "$func"
if [[ -n $new ]]; then
- bindkey "$3" | read -A opt
+ bindkey "$3" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] && bindkey "$3" "$1"
else
bindkey "$3" "$1"
@@ -353,7 +353,7 @@ compdef() {
# And bind the keys...
for i; do
if [[ -n $new ]]; then
- bindkey "$i" | read -A opt
+ bindkey "$i" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] || continue
fi
bindkey "$i" "$func"
@@ -469,7 +469,7 @@ _i_done=''
if [[ -f "$_comp_dumpfile" ]]; then
if [[ -n "$_i_check" ]]; then
- read -rA _i_line < "$_comp_dumpfile"
+ IFS=$' \t' read -rA _i_line < "$_comp_dumpfile"
if [[ _i_autodump -eq 1 && $_i_line[2] -eq $#_i_files &&
$ZSH_VERSION = $_i_line[4] ]]
then
@@ -491,7 +491,7 @@ if [[ -z "$_i_done" ]]; then
_i_name="${_i_file:t}"
(( $+_i_test[$_i_name] + $_i_wfiles[(I)$_i_file] )) && continue
_i_test[$_i_name]=yes
- read -rA _i_line < $_i_file
+ IFS=$' \t' read -rA _i_line < $_i_file
_i_tag=$_i_line[1]
shift _i_line
case $_i_tag in
@@ -527,7 +527,7 @@ zle -la menu-select && zle -C menu-select .menu-select _main_complete
# If the default completer set includes _expand, and tab is bound
# to expand-or-complete, rebind it to complete-word instead.
-bindkey '^i' | read -A _i_line
+bindkey '^i' | IFS=$' \t' read -A _i_line
if [[ ${_i_line[2]} = expand-or-complete ]] &&
zstyle -a ':completion:' completer _i_line &&
(( ${_i_line[(i)_expand]} <= ${#_i_line} )); then