diff options
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Command/_zfs | 139 | ||||
-rw-r--r-- | Completion/Unix/Command/_zpool | 21 | ||||
-rw-r--r-- | Completion/Unix/Type/_zfs_dataset | 3 |
3 files changed, 153 insertions, 10 deletions
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index 4cc24a59f..a9707ce36 100644 --- a/Completion/Unix/Command/_zfs +++ b/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 @@ _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)' ;; (*) diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool index 0af2ab32d..0f18eefb5 100644 --- a/Completion/Unix/Command/_zpool +++ b/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 @@ _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 \ diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset index d862011ac..64e343f3a 100644 --- a/Completion/Unix/Type/_zfs_dataset +++ b/Completion/Unix/Type/_zfs_dataset @@ -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 |