1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

32261: completion updates for Solaris 11, Update 1

This commit is contained in:
Danek Duvall 2014-01-02 11:52:24 -08:00 committed by Peter Stephenson
parent 60372fbda6
commit ef2eaf1f78
6 changed files with 186 additions and 12 deletions

View file

@ -1,5 +1,11 @@
2014-01-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Danek Duvall: 32216: Completion/Solaris/Command/_svcadm,
Completion/Solaris/Command/_zoneadm,
Completion/Unix/Command/_zfs, Completion/Unix/Command/_zpool,
Completion/Unix/Type/_zfs_dataset: updates for Solaris 11,
Update 1.
* 32196: Carl Drougge: Src/Zle/zle_misc.c: copy-prev-shell-word
needs an extra flag to work properly.

View file

@ -24,6 +24,7 @@ _svcadm() {
_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 @@ _svcadm() {
(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 @@ _svcadm() {
(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 @@ _svcadm() {
(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 @@ _svcadm() {
(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'
;;

View file

@ -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 @@ _zoneadm() {
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 @@ _zoneadm() {
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 @@ _zoneadm() {
_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 @@ _zoneadm() {
'-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 @@ _zoneadm() {
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 @@ _zoneadm() {
("uninstall")
_arguments -A "-*" \
'-F[Force]'
'-F[Force]' \
'-x[Extended options]:extended option:_values -w "extended option" $extended_destroy_options'
;;
esac
}

View file

@ -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 @@ _zfs() {
"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 @@ _zfs() {
"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 @@ _zfs() {
"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 @@ _zfs() {
"vscan:value:(on off)"
"xattr:value:(on off)"
"zoned:value:(on off)"
$share_rw_properties
)
create_properties=(
@ -246,7 +358,14 @@ _zfs() {
- 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 @@ _zfs() {
- 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 @@ _zfs() {
;;
("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)'
;;
(*)

View file

@ -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 @@ _zpool() {
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 @@ _zpool() {
"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 @@ _zpool() {
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 @@ _zpool() {
_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 \

View file

@ -14,6 +14,7 @@ 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 $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