* [PATCH] update Solaris completion to S11U1
@ 2014-01-02 19:52 Danek Duvall
0 siblings, 0 replies; only message in thread
From: Danek Duvall @ 2014-01-02 19:52 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 408 bytes --]
Here is a smallish patch to update the Solaris completion routines to match
what's in Solaris 11, Update 1 (which has been out for some time now; my
apologies).
Note that due to OpenSolaris being shuttered by Oracle, the zfs completion
routines may not be correct on other platforms; I don't know whether we
should move them back to the Solaris directory, do so when there's demand,
or what.
Thanks,
Danek
[-- Attachment #2: solaris-compl.patch --]
[-- Type: text/plain, Size: 13026 bytes --]
# HG changeset patch
# Parent f57514e19edec5f0479d28cab57ad6683b6c56d8
update completion to S11U1 FCS
diff --git a/components/zsh/Completion/Solaris/Command/_svcadm b/components/zsh/Completion/Solaris/Command/_svcadm
--- Completion/Solaris/Command/_svcadm
+++ Completion/Solaris/Command/_svcadm
@@ -24,6 +24,7 @@
_arguments -A "-*" \
'-r[Recursively enable dependencies]' \
'-s[Wait for service to come online]' \
+ '-T[Timeout for -s]:seconds:' \
'-t[State change is temporary]' \
'*:instance FMRI:_svcs_fmri -i'
;;
@@ -31,6 +32,7 @@
(disable)
_arguments -A "-*" \
'-s[Wait for service to become disabled]' \
+ '-T[Timeout for -s]:seconds:' \
'-t[State change is temporary]' \
'*:instance FMRI:_svcs_fmri -i'
;;
@@ -38,6 +40,8 @@
(mark)
_arguments -A "-*" \
'-I[Change state immediately]' \
+ "-s[Wait for service to reach the new state]" \
+ '-T[Timeout for -s]:seconds:' \
'-t[State change is temporary]' \
':state:(degraded maintenance)' \
':instance FMRI:_svcs_fmri -i'
@@ -45,12 +49,15 @@
(restart|refresh|clear)
_arguments \
+ "-s[Wait for service to $service]" \
+ '-T[Timeout for -s]:seconds:' \
'*:instance FMRI:_svcs_fmri -i'
;;
(delegate)
_arguments -A "-*" \
'-s[Wait for instances to come online]' \
+ '-T[Timeout for -s]:seconds:' \
':restarter FMRI:_svcs_fmri -r' \
'*:FMRI:_svcs_fmri -i'
;;
@@ -58,6 +65,8 @@
(milestone)
_arguments -A "-*" \
'-d[Make milestone the default]' \
+ '-s[Wait for the transition to the new milestone]' \
+ '-T[Timeout for -s]:seconds:' \
'*:milestone FMRI:_svcs_fmri -m'
;;
diff --git a/components/zsh/Completion/Solaris/Command/_zoneadm b/components/zsh/Completion/Solaris/Command/_zoneadm
--- Completion/Solaris/Command/_zoneadm
+++ Completion/Solaris/Command/_zoneadm
@@ -1,5 +1,5 @@
#compdef zoneadm
-# Synced with the S11U1 build 19 man page
+# Synced with the S11U1 man page
_zoneadm_bootargs() {
# This is a subset of the arguments to kernel(1M)
@@ -15,6 +15,7 @@
local -a subcmds fields
local -a solaris_attach solaris_install
local -a solaris10_attach solaris10_install
+ local -a extended_create_options extended_destroy_options
local brand brand_args
subcmds=(
@@ -22,6 +23,17 @@
ready reboot uninstall verify
)
+ extended_create_options=(
+ "force-zpool-import"
+ "force-zpool-create:ZFS pool: "
+ "force-zpool-create-all"
+ )
+
+ extended_destroy_options=(
+ "force-zpool-destroy:ZFS pool: "
+ "force-zpool-destroy-all"
+ )
+
solaris_attach=(
'(-d)-a[Path to archive]:path:_path_files'
'(-a)-d[Path to zonepath]:directory:_path_files -/'
@@ -82,6 +94,7 @@
_arguments -A "-*" \
'-m[Clone mode]:mode:_values "mode" copy' \
'-s[Source snapshot]:snapshot:_zfs_dataset -t snap' \
+ '-x[Extended options]:extended option:_values -w "extended option" $extended_create_options' \
':source zone:_zones'
;;
@@ -94,6 +107,7 @@
'-F[Force attach]' \
'-n[Path to zone manifest]:path to zone manifest:_path_files' \
'-u[Update on attach]' \
+ '-x[Extended options]:extended option:_values -w "extended option" $extended_create_options' \
${(P)brand_args}
;;
@@ -116,6 +130,7 @@
brand_args=${brand}_install
fi
_arguments -A "-*" \
+ '-x[Extended options]:extended option:_values -w "extended option" $extended_create_options' \
${(P)brand_args}
;;
@@ -139,7 +154,8 @@
("uninstall")
_arguments -A "-*" \
- '-F[Force]'
+ '-F[Force]' \
+ '-x[Extended options]:extended option:_values -w "extended option" $extended_destroy_options'
;;
esac
}
diff --git a/components/zsh/Completion/Unix/Command/_zfs b/components/zsh/Completion/Unix/Command/_zfs
--- Completion/Unix/Command/_zfs
+++ Completion/Unix/Command/_zfs
@@ -1,10 +1,13 @@
#compdef zfs
-# Synced with the S11U1 build 20 man page
+# Synced with the S11U1 man page
_zfs() {
local context state line expl
typeset -A opt_args
local -a subcmds rw_properties rw_propnames ro_properties create_properties
+ local -a share_nfs_ro_properties share_nfs_rw_properties
+ local -a share_smb_ro_properties share_nfs_rw_properties
+ local -a share_ro_properties share_rw_properties
local -a difffields delegatable_perms
subcmds=(
@@ -15,6 +18,115 @@
"diff" "key" "help"
)
+ share_nfs_ro_properties=(
+ "share.nfs.all"
+ )
+
+ share_nfs_rw_properties=(
+ "share.nfs:value:(on off)"
+ "share.nfs.aclok:value:(on off)"
+ "share.nfs.acflfab:value:(on off)"
+ "share.nfs.anon:uid:"
+ "share.nfs.charset.euc-cn:access-list:"
+ "share.nfs.charset.euc-jpms:access-list:"
+ "share.nfs.charset.euc-kr:access-list:"
+ "share.nfs.charset.euc-tw:access-list:"
+ "share.nfs.charset.iso8859-1:access-list:"
+ "share.nfs.charset.iso8859-2:access-list:"
+ "share.nfs.charset.iso8859-5:access-list:"
+ "share.nfs.charset.iso8859-6:access-list:"
+ "share.nfs.charset.iso8859-7:access-list:"
+ "share.nfs.charset.iso8859-8:access-list:"
+ "share.nfs.charset.iso8859-9:access-list:"
+ "share.nfs.charset.iso8859-13:access-list:"
+ "share.nfs.charset.iso8859-15:access-list:"
+ "share.nfs.charset.koi8-r:access-list:"
+ "share.nfs.index:file:_files"
+ "share.nfs.log:nfslog.conf tag:"
+ "share.nfs.nosub:value:(on off)"
+ "share.nfs.nosuid:value:(on off)"
+ "share.nfs.public:value:(on off)"
+ "share.nfs.sec:security-mode-list:"
+ "share.nfs.sec.default.none:access-list:"
+ "share.nfs.sec.default.ro:access-list:"
+ "share.nfs.sec.default.root:access-list:"
+ "share.nfs.sec.default.root_mapping:uid:"
+ "share.nfs.sec.default.rw:access-list:"
+ "share.nfs.sec.default.window:seconds"
+ "share.nfs.sec.dh.none:access-list:"
+ "share.nfs.sec.dh.ro:access-list:"
+ "share.nfs.sec.dh.root:access-list:"
+ "share.nfs.sec.dh.root_mapping:uid:"
+ "share.nfs.sec.dh.rw:access-list:"
+ "share.nfs.sec.dh.window:seconds"
+ "share.nfs.sec.krb5.none:access-list:"
+ "share.nfs.sec.krb5.ro:access-list:"
+ "share.nfs.sec.krb5.root:access-list:"
+ "share.nfs.sec.krb5.root_mapping:uid:"
+ "share.nfs.sec.krb5.rw:access-list:"
+ "share.nfs.sec.krb5.window:seconds"
+ "share.nfs.sec.krb5i.none:access-list:"
+ "share.nfs.sec.krb5i.ro:access-list:"
+ "share.nfs.sec.krb5i.root:access-list:"
+ "share.nfs.sec.krb5i.root_mapping:uid:"
+ "share.nfs.sec.krb5i.rw:access-list:"
+ "share.nfs.sec.krb5i.window:seconds"
+ "share.nfs.sec.krb5p.none:access-list:"
+ "share.nfs.sec.krb5p.ro:access-list:"
+ "share.nfs.sec.krb5p.root:access-list:"
+ "share.nfs.sec.krb5p.root_mapping:uid:"
+ "share.nfs.sec.krb5p.rw:access-list:"
+ "share.nfs.sec.krb5p.window:seconds"
+ "share.nfs.sec.none.none:access-list:"
+ "share.nfs.sec.none.ro:access-list:"
+ "share.nfs.sec.none.root:access-list:"
+ "share.nfs.sec.none.root_mapping:uid:"
+ "share.nfs.sec.none.rw:access-list:"
+ "share.nfs.sec.none.window:seconds"
+ "share.nfs.sec.sys.none:access-list:"
+ "share.nfs.sec.sys.ro:access-list:"
+ "share.nfs.sec.sys.root:access-list:"
+ "share.nfs.sec.sys.root_mapping:uid:"
+ "share.nfs.sec.sys.rw:access-list:"
+ "share.nfs.sec.sys.window:seconds"
+ )
+
+ share_smb_ro_properties=(
+ "share.smb.all"
+ )
+
+ share_smb_rw_properties=(
+ "share.smb:value:(on off)"
+ "share.smb.ad-container"
+ "share.smb.abe"
+ "share.smb.csc:value:(disabled manual auto vdo)"
+ "share.smb.catia:value:(on off)"
+ "share.smb.dfsroot:value:(on off)"
+ "share.smb.guestok:value:(on off)"
+ "share.smb.ro:access-list:"
+ "share.smb.rw:access-list:"
+ "share.smb.none:access-list:"
+ )
+
+ share_ro_properties=(
+ "share.all"
+ "share.fs"
+ "share.name"
+ "share.point"
+ "share.protocols"
+ "share.state"
+ $share_nfs_ro_properties
+ $share_smb_ro_properties
+ )
+
+ share_rw_properties=(
+ "share.desc:description:"
+ "share.noauto:value:(on off)"
+ "share.path:path:"
+ $share_nfs_rw_properties
+ $share_smb_rw_properties
+ )
+
# TODO: userused@ and groupused@ could have more extensive handling
ro_properties=(
"name" "type" "creation" "used" "available" "referenced"
@@ -22,6 +134,7 @@
"usedbydataset" "usedbyrefreservation" "usedbysnapshots"
"defer_destroy" "userused@" "userrefs" "groupused@"
"keychangedate" "keystatus" "rekeydate"
+ $share_ro_properties
)
# TODO: Be cleverer about what values can be set. Is there any way to
@@ -57,8 +170,6 @@
"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
@@ -67,6 +178,7 @@
"vscan:value:(on off)"
"xattr:value:(on off)"
"zoned:value:(on off)"
+ $share_rw_properties
)
create_properties=(
@@ -246,7 +358,14 @@
- set1 \
'-a[Share all available ZFS filesystems]' \
- set2 \
- ':filesystem:_zfs_dataset -t fs'
+ '-r[Share filesystems recursively]' \
+ ':filesystem:_zfs_dataset -t fs' \
+ - set3 \
+ '*-o[Create a share with these properties]:property:_values -w "share properties" $share_rw_properties' \
+ '-u[Create a share without sharing it]' \
+ ':filesystem:_zfs_dataset -t fs' \
+ - set4 \
+ ':filesystem:_zfs_dataset -t fs -t mtpt -t share'
;;
("unshare")
@@ -254,7 +373,10 @@
- set1 \
'-a[Unshare all shared ZFS filesystems]' \
- set2 \
- ':filesystem:_zfs_dataset -t fs -t mtpt'
+ '-r[Unshare filesystems recursively]' \
+ ':filesystem:_zfs_dataset -t fs' \
+ - set3 \
+ ':filesystem:_zfs_dataset -t fs -t mtpt -t share'
;;
("send")
@@ -410,7 +532,12 @@
;;
("help")
- compadd property $subcmds $ro_properties ${rw_properties%%:*}
+ _arguments -A "-*" \
+ - set1 \
+ ':command:($subcmds $delegatable_perms $ro_properties ${rw_properties%%:*} properties)' \
+ - set2 \
+ '-l[Display property information]' \
+ ': :(properties)'
;;
(*)
diff --git a/components/zsh/Completion/Unix/Command/_zpool b/components/zsh/Completion/Unix/Command/_zpool
--- Completion/Unix/Command/_zpool
+++ Completion/Unix/Command/_zpool
@@ -1,5 +1,5 @@
#compdef zpool
-# Synced with the S11U1 build 19 man page
+# Synced with the S11U1 man page
_zpool() {
local context state line expl
@@ -8,7 +8,7 @@
subcmds=(
create destroy add remove list iostat status online
offline clear attach detach replace scrub import export
- upgrade history get set split
+ upgrade history get set split help
)
versions=(
@@ -35,7 +35,9 @@
"dedupditto[Threshold for number of copies]:value:"
"delegation[Delegated administration]:value:(on off)"
"failmode[Failure-mode behavior]:value:(wait continue panic)"
+ "listshares[Show shares in 'zfs list']:value:(on off)"
"listsnaps[Show snapshots in 'zfs list']:value:(on off)"
+ "readonly[Controls whether the pool can be modified]:value:(on off)"
"version[Pool version]:version:($versions)"
)
@@ -97,9 +99,19 @@
fi
case $service in
+ (help)
+ _arguments -A "-*" \
+ - set1 \
+ ':command/property:($subcmds ${fields%%\[*} properties)' \
+ - set2 \
+ '-l[Display property information]' \
+ ': :(properties)'
+ ;;
+
(clear)
_arguments -A "-*" \
'-F[Discard transactions to allow pool opening]' \
+ '-f[Ignore fmadm acquit and fmadm repair failures]' \
'-n[With -F, check if discarding transactions would work]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
@@ -216,10 +228,13 @@
_arguments -A "-*" \
'-D[Destroyed pools]' \
'(-d)*-c[Use cache file]:cache file:_files' \
- '(-c)*-d[Search for devices or files in directory]:directory:_files -/' \
+ '(-c,-D)*-d[Search for devices or files in directory]:directory:_files -/' \
+ '-F[Recovery mode: discard transactions if required]' \
'-f[Force import]' \
'-l[Display configuration in /dev/chassis location form]' \
'-m[Ignore missing log devices]' \
+ '-N[Import pool without mounting any filesystems]' \
+ '-n[With -F; do not perform input]' \
'-R[Alternate root]:alternate root:_files -/' \
'-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
- set1 \
diff --git a/components/zsh/Completion/Unix/Type/_zfs_dataset b/components/zsh/Completion/Unix/Type/_zfs_dataset
--- Completion/Unix/Type/_zfs_dataset
+++ Completion/Unix/Type/_zfs_dataset
@@ -14,6 +14,7 @@ zparseopts -D -E e:=expl_type_arr p=path
[[ -n $type[(r)fs] ]] && typearg=( filesystem )
[[ -n $type[(r)vol] ]] && typearg=( $typearg volume )
[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot )
+[[ -n $type[(r)share] ]] && typearg=( $typearg share )
if [[ -n $typearg ]]; then
typearg=( -t ${(j:,:)typearg} )
# We know we're in zfs list if paths_allowed is non-empty.
@@ -34,7 +35,7 @@ if [[ ${#rsrc} -gt 0 ]]; then
elif [[ -n $words[(r)-p] ]]; then
typearg=( -t filesystem,volume )
else
- typearg=( -t filesystem,snapshot,volume )
+ typearg=( -t filesystem,share,snapshot,volume )
fi
fi
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-02 20:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-02 19:52 [PATCH] update Solaris completion to S11U1 Danek Duvall
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).