about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:52:36 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:52:36 +0000
commit7baf7019af11a806bf359dc029ecf0862340b6b7 (patch)
treec6a8b6d3b33ee18e364afc0ae26ea8e1f820a9a1
parent8e21fb0a3e5830d05d12d8cdc07902eda4ec5932 (diff)
downloadzsh-7baf7019af11a806bf359dc029ecf0862340b6b7.tar.gz
zsh-7baf7019af11a806bf359dc029ecf0862340b6b7.tar.xz
zsh-7baf7019af11a806bf359dc029ecf0862340b6b7.zip
moved from Completion/User/_gs
-rw-r--r--Completion/Unix/Command/_gs57
1 files changed, 57 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_gs b/Completion/Unix/Command/_gs
new file mode 100644
index 000000000..530edbe91
--- /dev/null
+++ b/Completion/Unix/Command/_gs
@@ -0,0 +1,57 @@
+#compdef gs ghostscript
+
+if compset -N --; then
+  if [[ CURRENT -eq 1 ]]; then
+    _pspdf
+  else
+    _message 'userdict ARGUMENTS'
+    return 1
+  fi
+else
+  local curcontext="$curcontext" state line ret=1
+  typeset -A opt_args
+
+  _x_arguments -C \
+    '-q[quiet startup]' \
+    '-g-[set device size]:device size (<width>x<height>):' \
+    '-r-[set resolution]:resolution (<val> or <x>x<y>):' \
+    '-I[add search paths]:search paths:_dir_list' \
+    \*-{d,D}'-[define name with definition]:def:->dname' \
+    \*-{s,S}'-[define name with value]:def:->sname' \
+    '*:PostScript or PDF file:_pspdf' && ret=0
+
+  case "$state" in
+  dname)
+    if [[ "$PREFIX" = *\=* ]]; then
+      _message 'systemdict definition value'
+    else
+      _wanted names expl 'systemdict definition name' \
+          compadd -M 'm:{a-z}={A-Z}' - \
+                  DISKFONTS NOCACHE NOBIND NODISPLAY NOPAUSE PLATFONTS SAFER \
+                  WRITESYSTEMDICT && ret=0
+    fi
+    ;;
+  sname)
+    if compset -P '*='; then
+      case "$IPREFIX" in
+      *DEVICE\=)
+        _wanted devices expl 'ghostscript device' \
+            compadd - "${(@)${=${$(_call_program devices gs -h)##* devices:}%%Search path:*}:#}" && ret=0
+        ;;
+      *OutputFile\=)
+        _description files expl 'output file'
+        _files "$expl[@]" && ret=0
+        ;;
+      *)
+        _message 'systemdict value'
+        return 1
+      esac
+    else
+      _wanted names expl 'systemdict name' \
+          compadd -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && ret=0
+    fi
+    ;;
+  esac
+
+  return ret
+fi