summary refs log tree commit diff
path: root/Completion/X/Command/_pdftk
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-01-09 16:57:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-01-09 16:57:01 +0000
commite72999c092b80b71c5913a52c411a1c7529971f4 (patch)
tree02974c6a4f7a4d73934481f731f12703a682fae7 /Completion/X/Command/_pdftk
parenta89f0559c210def9a40bfeb9da6b38128a49cb55 (diff)
downloadzsh-e72999c092b80b71c5913a52c411a1c7529971f4.tar.gz
zsh-e72999c092b80b71c5913a52c411a1c7529971f4.tar.xz
zsh-e72999c092b80b71c5913a52c411a1c7529971f4.zip
gi1242+zsh@gmail.com: 28594:
Various new and improved completions
Diffstat (limited to 'Completion/X/Command/_pdftk')
-rw-r--r--Completion/X/Command/_pdftk63
1 files changed, 63 insertions, 0 deletions
diff --git a/Completion/X/Command/_pdftk b/Completion/X/Command/_pdftk
new file mode 100644
index 000000000..b8c43f754
--- /dev/null
+++ b/Completion/X/Command/_pdftk
@@ -0,0 +1,63 @@
+#compdef pdftk
+
+_pdfwithhandle()
+{
+    compset -P '(#I)[A-Z]='
+    _files "$@" -g '(#i)*.pdf'
+}
+
+local expl
+local -a opts operations
+
+opts=(output encrypt_40bit encrypt_128bit allow owner_pw user_pw flatten
+	compress uncompress keep_first_id keep_final_id drop_xfa verbose
+	dont_ask do_ask)
+operations=(cat attach_files unpack_files burst fill_form background stamp
+	generate_fdf multibackground multistamp dump_data dump_data_fields
+	update_info)
+
+case $words[CURRENT-1] in
+    ((input|owner|user)_pw)
+	_message "password, or PROMPT"
+	;;
+
+    (allow)
+	#_description permissions expl "permission"
+	#compadd $expl \
+	_values -s , permissions \
+	    Printing DegradedPrinting ModifyContents Assembly CopyContents \
+	    ScreenReaders ModifyAnnotations FillIn AllFeatures
+	;;
+
+    (attach_files)
+	_files "$@"
+	;;
+
+    (fill_form)
+	_description files expl 'FDF and XFDF files'
+	_files "$@" $expl -g '(#i)*.(fdf|xfdf)'
+	;;
+
+    ((multibackground|background|stamp|multistamp|output))
+	_description files expl 'PDF files'
+	_files "$@" $expl -g '(#i)*.pdf'
+	;;
+
+    (update_info)
+	_files
+	;;
+
+    (*)
+	false
+	;;
+esac && return 0
+
+if [[ -n $words[(r)(${(j:|:)operations})] ]]; then
+    _description options expl "options"
+    compadd $@ $expl $opts
+else
+    _tags files operations
+    _alternative \
+	'files:PDF files:_pdfwithhandle' \
+	"operations:operations:($operations)"
+fi