about summary refs log tree commit diff
path: root/Completion/Unix/Type
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-06-21 08:50:14 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-06-21 08:50:14 +0000
commit71052cb69c455f8182e8f85ba8d4ea4be7e5caf0 (patch)
tree3cc9aa0959c21dfd32344e068dea009ec9f0af08 /Completion/Unix/Type
parentcbb8a3c762ba6034e5ae0c35e6d04c2de130f933 (diff)
downloadzsh-71052cb69c455f8182e8f85ba8d4ea4be7e5caf0.tar.gz
zsh-71052cb69c455f8182e8f85ba8d4ea4be7e5caf0.tar.xz
zsh-71052cb69c455f8182e8f85ba8d4ea4be7e5caf0.zip
Danek (plus .distfiles): 30520: updated Solaris 11 copmletion
Diffstat (limited to 'Completion/Unix/Type')
-rw-r--r--Completion/Unix/Type/.distfiles1
-rw-r--r--Completion/Unix/Type/_zfs_dataset20
-rw-r--r--Completion/Unix/Type/_zfs_keysource_props15
3 files changed, 31 insertions, 5 deletions
diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles
index a9dc0d147..4b5102191 100644
--- a/Completion/Unix/Type/.distfiles
+++ b/Completion/Unix/Type/.distfiles
@@ -50,5 +50,6 @@ _user_at_host
 _users
 _users_on
 _zfs_dataset
+_zfs_keysource_props
 _zfs_pool
 '
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 1840fb413..1cd49aebf 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -1,13 +1,24 @@
 #autoload
 
-local -a type typearg list
+local -a type paths_allowed typearg datasetlist expl
+local expl_type
 
-zparseopts -D -E -a type t+:
+zparseopts -D -E t+:=type p=paths_allowed
 
 [[ -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} )
+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
 
 datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} )
 
@@ -18,5 +29,4 @@ if [[ -n $type[(r)mtpt] ]]; then
 	expl_type="$expl_type/mountpoint"
 fi
 
-# compadd "$@" - $list
-_wanted dataset expl "$expl_type" _multi_parts "$@" / datasetlist
+_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