summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command/_zpool
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_zpool')
-rw-r--r--Completion/Unix/Command/_zpool187
1 files changed, 132 insertions, 55 deletions
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
index 9692121ae..568f493d0 100644
--- a/Completion/Unix/Command/_zpool
+++ b/Completion/Unix/Command/_zpool
@@ -1,41 +1,91 @@
#compdef zpool
+# Synced with the S11U1 build 16 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)"