about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-08-19 11:18:10 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-08-19 11:18:10 +0000
commite0dc07932aaa69889135112172515b484736a6cd (patch)
treebde42d23f16f7accca78d88c029b34eda4b8719f /Completion
parent03851842c66cce7e987df4e422337f4baa66abf4 (diff)
downloadzsh-e0dc07932aaa69889135112172515b484736a6cd.tar.gz
zsh-e0dc07932aaa69889135112172515b484736a6cd.tar.xz
zsh-e0dc07932aaa69889135112172515b484736a6cd.zip
Initial revision
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/_arguments388
-rw-r--r--Completion/Core/_description22
-rw-r--r--Completion/Core/_message19
-rw-r--r--Completion/Pbmplus/_asciitopnm3
-rw-r--r--Completion/Pbmplus/_fitstopgm3
-rw-r--r--Completion/Pbmplus/_fitstopnm4
-rw-r--r--Completion/Pbmplus/_g3topbm3
-rw-r--r--Completion/Pbmplus/_giftopnm4
-rw-r--r--Completion/Pbmplus/_macptopbm3
-rw-r--r--Completion/Pbmplus/_pbm_file20
-rw-r--r--Completion/Pbmplus/_pbmclean3
-rw-r--r--Completion/Pbmplus/_pbmmake3
-rw-r--r--Completion/Pbmplus/_pbmmask3
-rw-r--r--Completion/Pbmplus/_pbmpscale3
-rw-r--r--Completion/Pbmplus/_pbmreduce4
-rw-r--r--Completion/Pbmplus/_pbmtext3
-rw-r--r--Completion/Pbmplus/_pbmto10x3
-rw-r--r--Completion/Pbmplus/_pbmtobg3
-rw-r--r--Completion/Pbmplus/_pbmtoepsi3
-rw-r--r--Completion/Pbmplus/_pbmtolj3
-rw-r--r--Completion/Pbmplus/_pbmtoln035
-rw-r--r--Completion/Pbmplus/_pbmtolps3
-rw-r--r--Completion/Pbmplus/_pbmtomacp4
-rw-r--r--Completion/Pbmplus/_pbmtopgm3
-rw-r--r--Completion/Pbmplus/_pbmtopk11
-rw-r--r--Completion/Pbmplus/_pbmupc4
-rw-r--r--Completion/Pbmplus/_pgmcrater5
-rw-r--r--Completion/Pbmplus/_pgmkernel3
-rw-r--r--Completion/Pbmplus/_pgmnoise3
-rw-r--r--Completion/Pbmplus/_pgmnorm5
-rw-r--r--Completion/Pbmplus/_pgmoil3
-rw-r--r--Completion/Pbmplus/_pgmramp3
-rw-r--r--Completion/Pbmplus/_pgmtexture3
-rw-r--r--Completion/Pbmplus/_pgmtopbm5
-rw-r--r--Completion/Pbmplus/_pgmtoppm21
-rw-r--r--Completion/Pbmplus/_pktopbm4
-rw-r--r--Completion/Pbmplus/_pnmalias6
-rw-r--r--Completion/Pbmplus/_pnmarith3
-rw-r--r--Completion/Pbmplus/_pnmcat4
-rw-r--r--Completion/Pbmplus/_pnmcomp5
-rw-r--r--Completion/Pbmplus/_pnmconvol3
-rw-r--r--Completion/Pbmplus/_pnmcrop3
-rw-r--r--Completion/Pbmplus/_pnmcut3
-rw-r--r--Completion/Pbmplus/_pnmdepth3
-rw-r--r--Completion/Pbmplus/_pnmenlarge3
-rw-r--r--Completion/Pbmplus/_pnmflip5
-rw-r--r--Completion/Pbmplus/_pnmgamma16
-rw-r--r--Completion/Pbmplus/_pnmhistmap4
-rw-r--r--Completion/Pbmplus/_pnmindex4
-rw-r--r--Completion/Pbmplus/_pnmmargin4
-rw-r--r--Completion/Pbmplus/_pnmnlfilt3
-rw-r--r--Completion/Pbmplus/_pnmpad6
-rw-r--r--Completion/Pbmplus/_pnmpaste6
-rw-r--r--Completion/Pbmplus/_pnmrotate3
-rw-r--r--Completion/Pbmplus/_pnmscale16
-rw-r--r--Completion/Pbmplus/_pnmshear3
-rw-r--r--Completion/Pbmplus/_pnmtile3
-rw-r--r--Completion/Pbmplus/_pnmtoddif4
-rw-r--r--Completion/Pbmplus/_pnmtofits3
-rw-r--r--Completion/Pbmplus/_pnmtops5
-rw-r--r--Completion/Pbmplus/_pnmtorast3
-rw-r--r--Completion/Pbmplus/_pnmtosgi3
-rw-r--r--Completion/Pbmplus/_pnmtotiff5
-rw-r--r--Completion/Pbmplus/_pnmtoxwd4
-rw-r--r--Completion/Pbmplus/_ppm3d4
-rw-r--r--Completion/Pbmplus/_ppmbrighten3
-rw-r--r--Completion/Pbmplus/_ppmchange15
-rw-r--r--Completion/Pbmplus/_ppmdim3
-rw-r--r--Completion/Pbmplus/_ppmdist3
-rw-r--r--Completion/Pbmplus/_ppmdither7
-rw-r--r--Completion/Pbmplus/_ppmflash3
-rw-r--r--Completion/Pbmplus/_ppmforge13
-rw-r--r--Completion/Pbmplus/_ppmmake3
-rw-r--r--Completion/Pbmplus/_ppmmix3
-rw-r--r--Completion/Pbmplus/_ppmntsc3
-rw-r--r--Completion/Pbmplus/_ppmpat4
-rw-r--r--Completion/Pbmplus/_ppmquant26
-rw-r--r--Completion/Pbmplus/_ppmquantall3
-rw-r--r--Completion/Pbmplus/_ppmshift3
-rw-r--r--Completion/Pbmplus/_ppmspread3
-rw-r--r--Completion/Pbmplus/_ppmtoacad4
-rw-r--r--Completion/Pbmplus/_ppmtobmp3
-rw-r--r--Completion/Pbmplus/_ppmtogif3
-rw-r--r--Completion/Pbmplus/_ppmtoicr4
-rw-r--r--Completion/Pbmplus/_ppmtoilbm3
-rw-r--r--Completion/Pbmplus/_ppmtomap3
-rw-r--r--Completion/Pbmplus/_ppmtomitsu7
-rw-r--r--Completion/Pbmplus/_ppmtopj6
-rw-r--r--Completion/Pbmplus/_ppmtopjxl9
-rw-r--r--Completion/Pbmplus/_ppmtosixel3
-rw-r--r--Completion/Pbmplus/_ppmtotga3
-rw-r--r--Completion/Pbmplus/_ppmtouil3
-rw-r--r--Completion/Pbmplus/_ppmtoyuvsplit3
-rw-r--r--Completion/Pbmplus/_psidtopgm4
-rw-r--r--Completion/Pbmplus/_pstopnm10
-rw-r--r--Completion/Pbmplus/_rawtopgm5
-rw-r--r--Completion/Pbmplus/_rawtoppm6
-rw-r--r--Completion/Pbmplus/_rgb3toppm16
-rw-r--r--Completion/Pbmplus/_sgitopnm3
-rw-r--r--Completion/Pbmplus/_sldtoppm7
-rw-r--r--Completion/Pbmplus/_yuvsplittoppm3
-rw-r--r--Completion/Pbmplus/_yuvtoppm3
-rw-r--r--Completion/Pbmplus/_zeisstopnm3
103 files changed, 931 insertions, 0 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
new file mode 100644
index 000000000..5170acb84
--- /dev/null
+++ b/Completion/Base/_arguments
@@ -0,0 +1,388 @@
+#autoload
+
+# Complete the arguments of the current command according to the
+# descriptions given as arguments to this function.
+
+local long args rest ws cur nth def nm expl descr action opt arg tmp
+
+# Associative arrays used to collect information about the options.
+
+typeset -A opts mopts dopts dmopts odopts odmopts
+
+# See if we support long options, too.
+
+nth=$argv[(I)--]
+if (( nth )); then
+  long=( "${(@)argv[nth+1,-1]}" )
+  argv=("${(@)argv[1,nth-1]}")
+else
+  long=()
+fi
+
+# Now parse the arguments...
+
+args=()
+nth=1
+while (( $# )); do
+
+  # This describes a one-shot option.
+
+  if [[ "$1" = [-+]* ]]; then
+    if [[ "$1" = *:* ]]; then
+
+      # If the option name ends in a `-', the first argument comes
+      # directly after the option, if it ends in a `+', the first
+      # argument *may* come directly after the option, otherwise it
+      # is in the next word.
+
+      if [[ "$1" = [^:]##-:* ]]; then
+        dopts[${${1%%:*}[1,-2]}]="${1#*:}"
+      elif [[ "$1" = [^:]##+:* ]]; then
+        odopts[${${1%%:*}[1,-2]}]="${1#*:}"
+      else
+        opts[${1%%:*}]="${1#*:}"
+      fi
+    else
+      opts[$1]=''
+    fi
+  elif [[ "$1" = \*[-+]* ]]; then
+
+    # The same for options that may appear more than once.
+
+    if [[ "$1" = *:* ]]; then
+      if [[ "$1" = [^:]##-:* ]]; then
+        dmopts[${${1[2,-1]%%:*}[1,-2]}]="${1#*:}"
+      elif [[ "$1" = [^:]##+:* ]]; then
+        odmopts[${${1[2,-1]%%:*}[1,-2]}]="${1#*:}"
+      else
+        mopts[${1[2,-1]%%:*}]="${1#*:}"
+      fi
+    else
+      mopts[${1[2,-1]}]=''
+    fi
+  elif [[ "$1" = \*:* ]]; then
+
+    # This is `*:...', describing `all other arguments'.
+
+    rest="${1[3,-1]}"
+  elif [[ "$1" = :* ]]; then
+
+    # This is `:...', describing `the next argument'.
+
+    args[nth++]="${1#*:}"
+  else
+
+    # And this is `n:...', describing the `n'th argument.
+
+    args[${1%%:*}]="${1#*:}"
+    nth=$(( ${1%%:*} + 1 ))
+  fi
+  shift
+done
+
+if [[ $#long -ne 0 && "$PREFIX" = --* ]]; then
+
+   # If the current words starts with `--' and we should use long
+   # options, just call...
+
+  _long_options "$long[@]"
+else
+
+  # Otherwise parse the command line...
+
+  ws=( "${(@)words[2,-1]}" )
+  cur=$(( CURRENT-2 ))
+  nth=1
+
+  # ...until the current word is reached.
+
+  while [[ cur -gt 0 ]]; do
+
+    # `def' holds the description for the option we are currently after.
+    # Check if the next argument for the option is optional.
+
+    if [[ "$def" = :* ]]; then
+      opt=yes
+    else
+      opt=''
+    fi
+    arg=''
+
+    # Remove one description/action pair from `def' if that isn't empty.
+
+    if [[ -n "$def" ]]; then
+      if [[ "$def" = ?*:*:* ]]; then
+        def="${def#?*:*:}"
+      else
+        def=''
+      fi
+    else
+
+      # If it is empty, and the word starts with `--' and we should
+      # complete long options, just ignore this word, otherwise make sure
+      # we test for options below and handle normal arguments.
+
+      if [[ $#long -eq 0 || "$ws[1]" != --* ]]; then
+        opt=yes
+	arg=yes
+      else
+        def=''
+      fi
+    fi
+
+    if [[ -n "$opt" ]]; then
+
+      # `opt' was set above if we have to test if the word is an option.
+      # We first test for the simple options -- those without arguments or
+      # those whose arguments have to be given as separate words.
+
+      if (( $+opts[$ws[1]] )); then
+
+        # Options that may only be given once are removed from the
+        # associative array so that we are not offered them again.
+
+        def="$opts[$ws[1]]"
+        unset "opts[$ws[1]]"
+      elif (( $+mopts[$ws[1]] )); then
+        def="$mopts[$ws[1]]"
+      else
+
+        # If the word is none of the simple options, test for those
+        # whose first argument has to or may come directly after the
+        # option. This is done in four loops looking very much alike.
+
+        if (( $#dopts )); then
+
+	  # First we get the option names.
+
+	  tmp=( "${(@k)dopts}" )
+
+	  # Then we loop over them and see if the current word begins
+	  # with one of the option names.
+
+	  while (( $#tmp )); do
+	    [[ "$ws[1]" = ${tmp[1]}* ]] && break
+	    shift 1 tmp
+	  done
+
+	  if (( $#tmp )); then
+
+	    # It does. So use the description for it, but only from
+	    # the second argument on, because we are searching the
+	    # description for the next command line argument.
+
+	    opt=''
+	    def="$dopts[$tmp[1]]"
+	    unset "dopts[$tmp[1]]"
+	    if [[ "$def" = ?*:*:* ]]; then
+              def="${def#?*:*:}"
+            else
+              def=''
+	    fi
+          fi
+        fi
+	if [[ -n "$opt" && $#dmopts -ne 0 ]]; then
+	  tmp=( "${(@k)dmopts}" )
+	  while (( $#tmp )); do
+	    [[ "$ws[1]" = ${tmp[1]}* ]] && break
+	    shift 1 tmp
+	  done
+
+	  if (( $#tmp )); then
+	    opt=''
+	    def="$dmopts[$tmp[1]]"
+	    if [[ "$def" = ?*:*:* ]]; then
+              def="${def#?*:*:}"
+            else
+              def=''
+            fi
+          fi
+	fi
+        if [[ -n "$opt" && $#odopts -ne 0 ]]; then
+	  tmp=( "${(@k)odopts}" )
+	  while (( $#tmp )); do
+	    [[ "$ws[1]" = ${tmp[1]}* ]] && break
+	    shift 1 tmp
+	  done
+
+	  if (( $#tmp )); then
+	    opt=''
+	    def="$odopts[$tmp[1]]"
+	    unset "odopts[$tmp[1]]"
+
+	    # For options whose first argument *may* come after the
+	    # option, we skip over the first description only if there
+	    # is something after the option name on the line.
+
+	    if [[ "$ws[1]" != "$tmp[1]" ]]; then
+	      if [[ "$def" = ?*:*:* ]]; then
+                def="${def#?*:*:}"
+              else
+                def=''
+              fi
+	    fi
+          fi
+        fi
+	if [[ -n "$opt" && $#odmopts -ne 0 ]]; then
+	  tmp=( "${(@k)odmopts}" )
+	  while (( $#tmp )); do
+	    [[ "$ws[1]" = ${tmp[1]}* ]] && break
+	    shift 1 tmp
+	  done
+
+	  if (( $#tmp )); then
+	    opt=''
+	    def="$odmopts[$tmp[1]]"
+	    if [[ "$ws[1]" != "$tmp[1]" ]]; then
+	      if [[ "$def" = ?*:*:* ]]; then
+                def="${def#?*:*:}"
+              else
+                def=''
+              fi
+            fi
+          fi
+	fi
+
+	# If we didn't find a matching option description and we were
+	# told to use normal argument descriptions, just increase
+	# our counter `nth'.
+
+        if [[ -n "$opt" && -n "$arg" ]]; then
+          def=''
+	  (( nth++ ))
+        fi
+      fi
+    fi
+
+    shift 1 ws
+    (( cur-- ))
+  done
+
+  # Now generate the matches.
+
+  nm="$compstate[nmatches]"
+
+  if [[ -z "$def" || "$def" = :* ]]; then
+
+    # We either don't have a description for an argument of an option
+    # or we have a description for a optional argument.
+
+    if [[ -z "$def" ]]; then
+
+      # If we have none at all, use the one for this argument position.
+
+      def="$args[nth]"
+      [[ -z "$def" ]] && def="$rest"
+    fi
+
+    # In any case, we have to complete option names here, but we may
+    # be in a string that starts with an option names and continues with
+    # the first argument, test that (again, four loops).
+
+    opt=yes
+    if (( $#dopts )); then
+
+      # Get the option names.
+
+      tmp=( "${(@k)dopts}" )
+      while (( $#tmp )); do
+        if compset -P "$tmp[1]"; then
+
+	  # The current string starts with the option name, so ignore
+	  # that and complete the rest of the string.
+
+	  def="$dopts[$tmp[1]]"
+	  opt=''
+	  break
+        fi
+	shift 1 tmp
+      done
+    fi
+    if [[ -n "$opt" && $#dmopts -ne 0 ]]; then
+      tmp=( "${(@k)dmopts}" )
+      while (( $#tmp )); do
+        if compset -P "$tmp[1]"; then
+	  def="$dmopts[$tmp[1]]"
+	  opt=''
+	  break
+        fi
+	shift 1 tmp
+      done
+    fi
+    if [[ -n "$opt" && $#odopts -ne 0 ]]; then
+      tmp=( "${(@k)odopts}" )
+      while (( $#tmp )); do
+        if compset -P "$tmp[1]"; then
+	  def="$odopts[$tmp[1]]"
+	  opt=''
+	  break
+        fi
+	shift 1 tmp
+      done
+    fi
+    if [[ -n "$opt" && $#odmopts -ne 0 ]]; then
+      tmp=( "${(@k)odmopts}" )
+      while (( $#tmp )); do
+        if compset -P "$tmp[1]"; then
+	  def="$odmopts[$tmp[1]]"
+	  opt=''
+	  break
+        fi
+	shift 1 tmp
+      done
+    fi
+    if [[ -n "$opt" ]]; then
+
+      # We aren't in an argument directly after a option name, so
+      # all option names are possible matches.
+
+      _description expl option
+      compadd "$expl[@]" - "${(@k)opts}" "${(@k)mopts}" \
+                           "${(@k)dopts}" "${(@k)dmopts}" \
+			   "${(@k)odopts}" "${(@k)odmopts}"
+    fi
+  fi
+
+  # Now add the matches from the description, if any.
+
+  if [[ -n "$def" ]]; then
+
+    # Ignore the leading colon describing optional arguments.
+
+    [[ "$def" = :* ]] && def="$def[2,-1]"
+
+    # Get the description and the action.
+
+    descr="${def%%:*}"
+    action="${${def#*:}%%:*}"
+
+    _description expl "$descr"
+
+    if [[ -z "$action" ]]; then
+
+      # An empty action means that we should just display a message.
+      _message "$descr"
+      return 1
+    elif [[ "$action[1]" = \( ]]; then
+
+      # Anything inside `(...)' is added directly.
+
+      compadd "$expl[@]" - ${=action[2,-2]}
+    elif [[ "$action" = \ * ]]; then
+
+      # If the action starts with a space, we just call it.
+
+      $=action
+    else
+
+      # Otherwise we call it with the description-arguments built above.
+
+      action=( $=action )
+      "$action[1]" "$expl[@]" "${(@)action[2,-1]}"
+    fi
+  fi
+
+  # Set the return value.
+
+  [[  nm -ne "$compstate[nmatches]" ]]
+fi
diff --git a/Completion/Core/_description b/Completion/Core/_description
new file mode 100644
index 000000000..874ba8a96
--- /dev/null
+++ b/Completion/Core/_description
@@ -0,0 +1,22 @@
+#autoload
+
+local gropt=-J
+
+if [[ "$1" = -V ]]; then
+  gropt=-V
+  shift
+fi
+
+if [[ -n "$compconfig[group_matches]" ]]; then
+  if [[ -n "$compconfig[description_format]" ]]; then
+    eval "$1=($gropt ${(q)2} -X ${(q)compconfig[description_format]//\\%d/$2})"
+  else
+    eval "$1=($gropt ${(q)2})"
+  fi
+else
+  if [[ -n "$compconfig[description_format]" ]]; then
+    eval "$1=(-X ${(q)compconfig[description_format]//\\%d/$2})"
+  else
+    eval "$1=()"
+  fi
+fi
diff --git a/Completion/Core/_message b/Completion/Core/_message
new file mode 100644
index 000000000..0837cdf2f
--- /dev/null
+++ b/Completion/Core/_message
@@ -0,0 +1,19 @@
+#autoload
+
+local format
+
+format="$compconfig[message_format]"
+[[ -z "$format" ]] && "$compconfig[description_format]"
+
+if [[ -n "$format" ]]; then
+  if [[ $compstate[nmatches] -eq 0 ]]; then
+    compstate[list]=list
+    compstate[insert]=''
+    compadd -UX "${format//\\%d/$1}" -n ''
+  else
+    compadd -X "${format//\\%d/$1}" -n ''
+  fi
+  compstate[force_list]=yes
+else
+  compadd -n ''
+fi
diff --git a/Completion/Pbmplus/_asciitopnm b/Completion/Pbmplus/_asciitopnm
new file mode 100644
index 000000000..70f95692c
--- /dev/null
+++ b/Completion/Pbmplus/_asciitopnm
@@ -0,0 +1,3 @@
+#compdef asciitopnm
+
+_arguments '-d:divisor:' ':height:' ':width:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_fitstopgm b/Completion/Pbmplus/_fitstopgm
new file mode 100644
index 000000000..de19bd9ea
--- /dev/null
+++ b/Completion/Pbmplus/_fitstopgm
@@ -0,0 +1,3 @@
+#compdef fitstopgm
+
+_arguments '-image:image number:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_fitstopnm b/Completion/Pbmplus/_fitstopnm
new file mode 100644
index 000000000..6dcd56134
--- /dev/null
+++ b/Completion/Pbmplus/_fitstopnm
@@ -0,0 +1,4 @@
+#compdef fitstopnm
+
+_arguments '-image:image number:' '-noraw' '-scanmax' '-printmax' \
+           '-min:minimum value:' '-max:maximum value:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_g3topbm b/Completion/Pbmplus/_g3topbm
new file mode 100644
index 000000000..c6cfa34fe
--- /dev/null
+++ b/Completion/Pbmplus/_g3topbm
@@ -0,0 +1,3 @@
+#compdef g3topbm
+
+_arguments '-kludge' '-reversebits' '-stretch' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_giftopnm b/Completion/Pbmplus/_giftopnm
new file mode 100644
index 000000000..1a3e6e1c3
--- /dev/null
+++ b/Completion/Pbmplus/_giftopnm
@@ -0,0 +1,4 @@
+#compdef giftopnm
+
+_arguments '-verbose' '-comments' '-image:image number:' \
+           ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_macptopbm b/Completion/Pbmplus/_macptopbm
new file mode 100644
index 000000000..ffcd280ad
--- /dev/null
+++ b/Completion/Pbmplus/_macptopbm
@@ -0,0 +1,3 @@
+#compdef macptopbm
+
+_arguments '-extraskip:number of bytes to skip:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbm_file b/Completion/Pbmplus/_pbm_file
new file mode 100644
index 000000000..6f96d9460
--- /dev/null
+++ b/Completion/Pbmplus/_pbm_file
@@ -0,0 +1,20 @@
+#compdef -P (p[bgpn]m*|*top[bgpn]m)
+
+local expl
+
+if [[ "$words[1]" = pnm* ]]; then
+  pat='*.(#i)p[bgp]m'
+elif [[ "$words[1]" = *top[bgpn]m ]]; then
+  pat="*.(#i)${words[1]%%top[bgpn]m}"
+else
+  pat="*.(#i)${words[1][1,3]}"
+fi
+
+if (( $# )); then
+  expl=( "$@" )
+else
+  _description expl 'picture file'
+fi
+
+_path_files "$expl[@]" -g "$pat" ||
+    _files "$expl[@]" -g '*.(#i)p[bgp]m'
diff --git a/Completion/Pbmplus/_pbmclean b/Completion/Pbmplus/_pbmclean
new file mode 100644
index 000000000..8b265cb29
--- /dev/null
+++ b/Completion/Pbmplus/_pbmclean
@@ -0,0 +1,3 @@
+#compdef pbmclean
+
+_arguments '-connect' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmmake b/Completion/Pbmplus/_pbmmake
new file mode 100644
index 000000000..ffb437a5e
--- /dev/null
+++ b/Completion/Pbmplus/_pbmmake
@@ -0,0 +1,3 @@
+#compdef pbmmake
+
+_arguments '-white' '-black' '-gray' ':width:' ':height:'
diff --git a/Completion/Pbmplus/_pbmmask b/Completion/Pbmplus/_pbmmask
new file mode 100644
index 000000000..2207ce772
--- /dev/null
+++ b/Completion/Pbmplus/_pbmmask
@@ -0,0 +1,3 @@
+#compdef pbmmask
+
+_arguments '-expand' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmpscale b/Completion/Pbmplus/_pbmpscale
new file mode 100644
index 000000000..76c00b247
--- /dev/null
+++ b/Completion/Pbmplus/_pbmpscale
@@ -0,0 +1,3 @@
+#compdef pbmpscale
+
+_arguments ':scale factor:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmreduce b/Completion/Pbmplus/_pbmreduce
new file mode 100644
index 000000000..8a32e6a88
--- /dev/null
+++ b/Completion/Pbmplus/_pbmreduce
@@ -0,0 +1,4 @@
+#compdef pbmreduce
+
+_arguments '-floyd' '-fs' '-threshold' '-value:threshold value:' \
+           ':reduction factor:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtext b/Completion/Pbmplus/_pbmtext
new file mode 100644
index 000000000..1ef1fd9f1
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtext
@@ -0,0 +1,3 @@
+#compdef pbmtext
+
+_arguments '-font:font file:_files -g *.(#i)pbm' '*:text:'
diff --git a/Completion/Pbmplus/_pbmto10x b/Completion/Pbmplus/_pbmto10x
new file mode 100644
index 000000000..ce233e5ae
--- /dev/null
+++ b/Completion/Pbmplus/_pbmto10x
@@ -0,0 +1,3 @@
+#compdef pbmto10x
+
+_arguments '-h' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtobg b/Completion/Pbmplus/_pbmtobg
new file mode 100644
index 000000000..729332745
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtobg
@@ -0,0 +1,3 @@
+#compdef pbmtobg pbmtobbnbg
+
+_arguments ':raster operation:' ':x position:' ':y position:'
diff --git a/Completion/Pbmplus/_pbmtoepsi b/Completion/Pbmplus/_pbmtoepsi
new file mode 100644
index 000000000..7bba77295
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtoepsi
@@ -0,0 +1,3 @@
+#compdef pbmtoepsi
+
+_arguments '--bbonly' ':file: _pbmfile'
diff --git a/Completion/Pbmplus/_pbmtolj b/Completion/Pbmplus/_pbmtolj
new file mode 100644
index 000000000..6ccc63b6d
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtolj
@@ -0,0 +1,3 @@
+#compdef pbmtolj
+
+_arguments '-resolution:resolution:(75 100 150 300)' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtoln03 b/Completion/Pbmplus/_pbmtoln03
new file mode 100644
index 000000000..12b106dea
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtoln03
@@ -0,0 +1,5 @@
+#compdef pbmtoln03
+
+_arguments '-l:left margin:' '-r:right margin:' \
+           '-t:top margin:'  '-b:bottom margin:' \
+           '-f:form length:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtolps b/Completion/Pbmplus/_pbmtolps
new file mode 100644
index 000000000..801948c11
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtolps
@@ -0,0 +1,3 @@
+#compdef pbmtolps
+
+_arguments '-dpi:resolution:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtomacp b/Completion/Pbmplus/_pbmtomacp
new file mode 100644
index 000000000..aa9e94e73
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtomacp
@@ -0,0 +1,4 @@
+#compdef pbmtomacp
+
+_arguments '-l:left offset:' '-r:right offset:' \
+           '-t:top offset:'  '-b:bottom offset:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtopgm b/Completion/Pbmplus/_pbmtopgm
new file mode 100644
index 000000000..29bd5422f
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtopgm
@@ -0,0 +1,3 @@
+#compdef pbmtopgm
+
+_arguments ':width:' ':height:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmtopk b/Completion/Pbmplus/_pbmtopk
new file mode 100644
index 000000000..913d11106
--- /dev/null
+++ b/Completion/Pbmplus/_pbmtopk
@@ -0,0 +1,11 @@
+#compdef pbmtopk
+
+# This could be improved...
+
+_arguments '-s:design size:' '-C:coding scheme:' '-F:font family:' \
+           '-f:option file:_files' '-c:character number:' \
+           '-W:width:' '-H:height:' '-D:depth:' '-I:italic correction:' \
+           '-h:horizontal escapement:' '-v:vertical escapement:' \
+	   '-x:x offset:' '-y:y offset:' \
+           ':pk file:_files -g *.(#i)pk' ':tfm file:_files -g *.(#i)tfm' \
+	   '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_pbmupc b/Completion/Pbmplus/_pbmupc
new file mode 100644
index 000000000..b77488d57
--- /dev/null
+++ b/Completion/Pbmplus/_pbmupc
@@ -0,0 +1,4 @@
+#compdef pbmupc
+
+_arguments '-s1' '-s2' ':product type:' ':manufacturer code:' \
+           ':product code:'
diff --git a/Completion/Pbmplus/_pgmcrater b/Completion/Pbmplus/_pgmcrater
new file mode 100644
index 000000000..5905ea8a2
--- /dev/null
+++ b/Completion/Pbmplus/_pgmcrater
@@ -0,0 +1,5 @@
+#compdef pgmcrater
+
+_arguments '-number:number of craters:' '-gamma:factor:' \
+           '-height:height:' '-ysize:height:' \
+	   '-width:width:'   '-xsize:width:'
diff --git a/Completion/Pbmplus/_pgmkernel b/Completion/Pbmplus/_pgmkernel
new file mode 100644
index 000000000..83a3e6ae2
--- /dev/null
+++ b/Completion/Pbmplus/_pgmkernel
@@ -0,0 +1,3 @@
+#compdef pgmkernel
+
+_arguments '-weight:weight:' ':width:' ':height:'
diff --git a/Completion/Pbmplus/_pgmnoise b/Completion/Pbmplus/_pgmnoise
new file mode 100644
index 000000000..efcd5b82b
--- /dev/null
+++ b/Completion/Pbmplus/_pgmnoise
@@ -0,0 +1,3 @@
+#compdef pgmnoise
+
+_arguments ':width:' ':height:'
diff --git a/Completion/Pbmplus/_pgmnorm b/Completion/Pbmplus/_pgmnorm
new file mode 100644
index 000000000..e088550e9
--- /dev/null
+++ b/Completion/Pbmplus/_pgmnorm
@@ -0,0 +1,5 @@
+#compdef pgmnorm ppmnorm
+
+_arguments '-bpercent:black percentage:' '-bvalue:black pixel value:' \
+           '-wpercent:white percentage:' '-wvalue:white pixel value:' \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pgmoil b/Completion/Pbmplus/_pgmoil
new file mode 100644
index 000000000..e1c7a0c0f
--- /dev/null
+++ b/Completion/Pbmplus/_pgmoil
@@ -0,0 +1,3 @@
+#compdef pgmoil
+
+_arguments '-n:smear size:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pgmramp b/Completion/Pbmplus/_pgmramp
new file mode 100644
index 000000000..9fa7c0b54
--- /dev/null
+++ b/Completion/Pbmplus/_pgmramp
@@ -0,0 +1,3 @@
+#compdef pgmramp
+
+_arguments '-lr' '-tb' '-rectangle' '-ellipse' ':width:' ':height:'
diff --git a/Completion/Pbmplus/_pgmtexture b/Completion/Pbmplus/_pgmtexture
new file mode 100644
index 000000000..48e29066a
--- /dev/null
+++ b/Completion/Pbmplus/_pgmtexture
@@ -0,0 +1,3 @@
+#compdef pgmtexture
+
+_arguments '-d:distance:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pgmtopbm b/Completion/Pbmplus/_pgmtopbm
new file mode 100644
index 000000000..642d6277b
--- /dev/null
+++ b/Completion/Pbmplus/_pgmtopbm
@@ -0,0 +1,5 @@
+#compdef pgmtopbm
+
+_arguments '-floyd' '-fs' '-threshold' '-dither8' '-d8' '-cluster3' '-c3' \
+           '-cluster4' '-c4' '-cluster8' '-c8' '-value:threshold value:' \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pgmtoppm b/Completion/Pbmplus/_pgmtoppm
new file mode 100644
index 000000000..c8b1abec6
--- /dev/null
+++ b/Completion/Pbmplus/_pgmtoppm
@@ -0,0 +1,21 @@
+#compdef pgmtoppm
+
+local ret=1 expl
+
+if [[ CURRENT -eq 2 ]]; then
+  if compset -P '?*-'; then
+    _colors
+    return
+  fi
+  _colors && ret=0
+
+  _description expl option
+  compadd "$expl[@]" - -map && ret=0
+
+  return ret
+elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then
+  _description expl 'map file'
+  _files "$expl[@]" -g '*.(#i)ppm'
+else
+  _pbm_file
+fi
diff --git a/Completion/Pbmplus/_pktopbm b/Completion/Pbmplus/_pktopbm
new file mode 100644
index 000000000..5b97fdd33
--- /dev/null
+++ b/Completion/Pbmplus/_pktopbm
@@ -0,0 +1,4 @@
+#compdef pktopbm
+
+_arguments ':pk file:_file -g *.(#i)pk' '-c:character number:' \
+           '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmalias b/Completion/Pbmplus/_pnmalias
new file mode 100644
index 000000000..4dda6fb9f
--- /dev/null
+++ b/Completion/Pbmplus/_pnmalias
@@ -0,0 +1,6 @@
+#compdef pnmalias
+
+_arguments '-bgcolor:background color:_colors' \
+           '-fgcolor:foreground color:_colors' \
+	   '-bonly' '-fonly' '-balias' '-falias' \
+	   '-weight:central aliasing weight:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmarith b/Completion/Pbmplus/_pnmarith
new file mode 100644
index 000000000..568c923db
--- /dev/null
+++ b/Completion/Pbmplus/_pnmarith
@@ -0,0 +1,3 @@
+#compdef pnmarith
+
+_arguments '-add' '-subtract' '-multiply' '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmcat b/Completion/Pbmplus/_pnmcat
new file mode 100644
index 000000000..6d71cae10
--- /dev/null
+++ b/Completion/Pbmplus/_pnmcat
@@ -0,0 +1,4 @@
+#compdef pnmcat
+
+_arguments '-white' '-black' '-leftright' '-lr' '-topbottom' '-tb' \
+           '-jtop' '-jbottom' '-jleft' '-jright' '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmcomp b/Completion/Pbmplus/_pnmcomp
new file mode 100644
index 000000000..01f8bb33e
--- /dev/null
+++ b/Completion/Pbmplus/_pnmcomp
@@ -0,0 +1,5 @@
+#compdef pnmcomp
+
+_arguments '-invert' '-xoff:x offset:' '-yoff:y offset:' \
+           '-alpha:alpha mask file:_files -g *.(#i)pgm' \
+	   ':overlay file:_pbm_file' '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmconvol b/Completion/Pbmplus/_pnmconvol
new file mode 100644
index 000000000..69785b3d1
--- /dev/null
+++ b/Completion/Pbmplus/_pnmconvol
@@ -0,0 +1,3 @@
+#compdef pnmconvol
+
+_arguments ':convolution file:_pbm_file' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmcrop b/Completion/Pbmplus/_pnmcrop
new file mode 100644
index 000000000..a7a29cacb
--- /dev/null
+++ b/Completion/Pbmplus/_pnmcrop
@@ -0,0 +1,3 @@
+#compdef pnmcrop
+
+_arguments '-white' '-black' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmcut b/Completion/Pbmplus/_pnmcut
new file mode 100644
index 000000000..7e3884b59
--- /dev/null
+++ b/Completion/Pbmplus/_pnmcut
@@ -0,0 +1,3 @@
+#compdef pnmcut
+
+_arguments ':x position:' ':y position:' ':width:' ':height:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmdepth b/Completion/Pbmplus/_pnmdepth
new file mode 100644
index 000000000..76263c595
--- /dev/null
+++ b/Completion/Pbmplus/_pnmdepth
@@ -0,0 +1,3 @@
+#compdef pnmdepth
+
+_arguments ':new maximum value:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmenlarge b/Completion/Pbmplus/_pnmenlarge
new file mode 100644
index 000000000..511122f9f
--- /dev/null
+++ b/Completion/Pbmplus/_pnmenlarge
@@ -0,0 +1,3 @@
+#compdef pnmenlarge
+
+_arguments ':enlargement factor:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmflip b/Completion/Pbmplus/_pnmflip
new file mode 100644
index 000000000..ecec27dd9
--- /dev/null
+++ b/Completion/Pbmplus/_pnmflip
@@ -0,0 +1,5 @@
+#compdef pnmflip
+
+_arguments '-leftright' '-lr' '-topbottom' '-tb' '-transpose' '-xy' \
+           '-rotate90' '-r90' '-ccw' '-rotate270' '-r270' '-cw' \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmgamma b/Completion/Pbmplus/_pnmgamma
new file mode 100644
index 000000000..c9d141535
--- /dev/null
+++ b/Completion/Pbmplus/_pnmgamma
@@ -0,0 +1,16 @@
+#compdef pnmgamma
+
+local ret=1
+
+if [[ CURRENT -eq 2 ]]; then
+  _message 'gamma value or red gamma value'
+elif [[ CURRENT -eq 3 ]]; then
+  _pbm_file && ret=0
+  _message 'green gamma value'
+elif [[ CURRENT -eq 4 ]]; then
+  _message 'blue gamma value'
+elif [[ CURRENT -eq 5 ]]; then
+  _pbm_file && ret=0
+fi
+
+return ret
diff --git a/Completion/Pbmplus/_pnmhistmap b/Completion/Pbmplus/_pnmhistmap
new file mode 100644
index 000000000..b011c2d94
--- /dev/null
+++ b/Completion/Pbmplus/_pnmhistmap
@@ -0,0 +1,4 @@
+#compdef pnmhistmap
+
+_arguments '-black' '-white' '-max:maximum value:' '-verbose' \
+           ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmindex b/Completion/Pbmplus/_pnmindex
new file mode 100644
index 000000000..39b6bacbb
--- /dev/null
+++ b/Completion/Pbmplus/_pnmindex
@@ -0,0 +1,4 @@
+#compdef pnmindex
+
+_arguments '-size:image size:' '-across:images per row:' \
+           '-colors:number of colors:' '-black' '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmmargin b/Completion/Pbmplus/_pnmmargin
new file mode 100644
index 000000000..90e196f8d
--- /dev/null
+++ b/Completion/Pbmplus/_pnmmargin
@@ -0,0 +1,4 @@
+#compdef pnmmargin
+
+_arguments '-white' '-black' '-color:color: _colors' \
+           ':border width:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmnlfilt b/Completion/Pbmplus/_pnmnlfilt
new file mode 100644
index 000000000..c5a25053d
--- /dev/null
+++ b/Completion/Pbmplus/_pnmnlfilt
@@ -0,0 +1,3 @@
+#compdef pnmnlfilt
+
+_arguments ':alpha value:' ':radius:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmpad b/Completion/Pbmplus/_pnmpad
new file mode 100644
index 000000000..9516c5281
--- /dev/null
+++ b/Completion/Pbmplus/_pnmpad
@@ -0,0 +1,6 @@
+#compdef pnmpad
+
+_arguments '-black' '-white' \
+           '-l-:left border width:' '-r-:right border width:' \
+           '-t-:top border width:' '-b-:bottom border width:' \
+           ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmpaste b/Completion/Pbmplus/_pnmpaste
new file mode 100644
index 000000000..2728d959d
--- /dev/null
+++ b/Completion/Pbmplus/_pnmpaste
@@ -0,0 +1,6 @@
+#compdef pnmpaste
+
+_arguments '-replace' '-or' '-and' '-xor' \
+           ':"from" picture file:_pbm_file' \
+	   ':x position:' ':y position:' \
+	   ':"into" picture file:_pbm_file'
diff --git a/Completion/Pbmplus/_pnmrotate b/Completion/Pbmplus/_pnmrotate
new file mode 100644
index 000000000..84e568ec9
--- /dev/null
+++ b/Completion/Pbmplus/_pnmrotate
@@ -0,0 +1,3 @@
+#compdef pnmrotate
+
+_arguments '-noantialias' ':rotation angle:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmscale b/Completion/Pbmplus/_pnmscale
new file mode 100644
index 000000000..3b56071b0
--- /dev/null
+++ b/Completion/Pbmplus/_pnmscale
@@ -0,0 +1,16 @@
+#compdef pnmscale
+
+local scale
+
+if [[ "$words[2]" = -* ]]; then
+  scale=()
+else
+  scale=( ':scale factor:' )
+fi
+
+_arguments '-xsize:width:'  '-width:width:' \
+           '-ysize:height:' '-height:height:' \
+	   '-xscale:horizontal scale factor:' \
+	   '-yscale:horizontal scale factor:' \
+	   '-xysize:width::height:' "$scale[@]" \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmshear b/Completion/Pbmplus/_pnmshear
new file mode 100644
index 000000000..a94e4347b
--- /dev/null
+++ b/Completion/Pbmplus/_pnmshear
@@ -0,0 +1,3 @@
+#compdef pnmshear
+
+_arguments '-noantialias' ':shearing angle:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtile b/Completion/Pbmplus/_pnmtile
new file mode 100644
index 000000000..eb2a45989
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtile
@@ -0,0 +1,3 @@
+#compdef pnmtile
+
+_arguments ':width:' ':height:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtoddif b/Completion/Pbmplus/_pnmtoddif
new file mode 100644
index 000000000..c7578c792
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtoddif
@@ -0,0 +1,4 @@
+#compdef pnmtoddif
+
+_arguments '-resolution:horizontal resolution::vertical resolution:' \
+           ':file: _pbm_file' ':ddif file:_files -g *.(#i)ddif'
diff --git a/Completion/Pbmplus/_pnmtofits b/Completion/Pbmplus/_pnmtofits
new file mode 100644
index 000000000..fe3e33569
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtofits
@@ -0,0 +1,3 @@
+#compdef pnmtofits
+
+_arguments '-max:maximum value:' '-min:minimum value:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtops b/Completion/Pbmplus/_pnmtops
new file mode 100644
index 000000000..4b66701a0
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtops
@@ -0,0 +1,5 @@
+#compdef pnmtops
+
+_arguments '-scale:scale factor:' '-turn' '-noturn' '-rle' '-runlength' \
+           '-dpi:output resolution:' \
+           '-width:page width:' '-height:page height' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtorast b/Completion/Pbmplus/_pnmtorast
new file mode 100644
index 000000000..e6d04db0c
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtorast
@@ -0,0 +1,3 @@
+#compdef pnmtorast
+
+_arguments '-standard' '-rle' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtosgi b/Completion/Pbmplus/_pnmtosgi
new file mode 100644
index 000000000..efbbc3886
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtosgi
@@ -0,0 +1,3 @@
+#compdef pnmtosgi
+
+_arguments '-verbatim' '-rle' '-imagename:image name:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtotiff b/Completion/Pbmplus/_pnmtotiff
new file mode 100644
index 000000000..5cc170190
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtotiff
@@ -0,0 +1,5 @@
+#compdef pnmtotiff
+
+_arguments '-none' '-packbits' '-lzw' '-g3' '-g4' '-2d' '-fill' \
+           '-predictor:LZW predictor:(1 2)' '-msb2lsb' '-lsb2msb' \
+	   '-rowsperstrip:number of rows per strip:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_pnmtoxwd b/Completion/Pbmplus/_pnmtoxwd
new file mode 100644
index 000000000..1c8b2393d
--- /dev/null
+++ b/Completion/Pbmplus/_pnmtoxwd
@@ -0,0 +1,4 @@
+#compdef pnmtoxwd
+
+_arguments '-pseudodepth:depth of PseudoColor dumps:' '-directcolor' \
+           ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppm3d b/Completion/Pbmplus/_ppm3d
new file mode 100644
index 000000000..8f3cc0434
--- /dev/null
+++ b/Completion/Pbmplus/_ppm3d
@@ -0,0 +1,4 @@
+#compdef ppm3d
+
+_arguments ':left picture file:_pbm_file' ':right picture file:_pbm_file' \
+           ':horizontal offset:'
diff --git a/Completion/Pbmplus/_ppmbrighten b/Completion/Pbmplus/_ppmbrighten
new file mode 100644
index 000000000..0fbc6ddaf
--- /dev/null
+++ b/Completion/Pbmplus/_ppmbrighten
@@ -0,0 +1,3 @@
+#compdef ppmbrighten
+
+_arguments '-n' '-s:saturation:' '-v:value:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmchange b/Completion/Pbmplus/_ppmchange
new file mode 100644
index 000000000..45c83ea2e
--- /dev/null
+++ b/Completion/Pbmplus/_ppmchange
@@ -0,0 +1,15 @@
+#compdef ppmchange
+
+local ret=1 expl
+
+_pbm_file && ret=0
+
+if (( CURRENT & 1 )); then
+  _description expl 'new color'
+else
+  _description expl 'old color'
+fi
+
+_colors "$expl[@]" && ret=0
+
+return ret
diff --git a/Completion/Pbmplus/_ppmdim b/Completion/Pbmplus/_ppmdim
new file mode 100644
index 000000000..7dd001809
--- /dev/null
+++ b/Completion/Pbmplus/_ppmdim
@@ -0,0 +1,3 @@
+#compdef ppmdim
+
+_arguments ':diminishing factor:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmdist b/Completion/Pbmplus/_ppmdist
new file mode 100644
index 000000000..c825cabb3
--- /dev/null
+++ b/Completion/Pbmplus/_ppmdist
@@ -0,0 +1,3 @@
+#compdef ppmdist
+
+_arguments '-intensity' '-frequency' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmdither b/Completion/Pbmplus/_ppmdither
new file mode 100644
index 000000000..94a52e68d
--- /dev/null
+++ b/Completion/Pbmplus/_ppmdither
@@ -0,0 +1,7 @@
+#compdef ppmdither
+
+_arguments '-dim:matrix size:' \
+           '-red:number of red shades:' \
+           '-green:number of green shades:' \
+           '-blue:number of blue shades:' \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmflash b/Completion/Pbmplus/_ppmflash
new file mode 100644
index 000000000..addc5e460
--- /dev/null
+++ b/Completion/Pbmplus/_ppmflash
@@ -0,0 +1,3 @@
+#compdef ppmflash
+
+_arguments ':flash factor:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmforge b/Completion/Pbmplus/_ppmforge
new file mode 100644
index 000000000..ab8838afd
--- /dev/null
+++ b/Completion/Pbmplus/_ppmforge
@@ -0,0 +1,13 @@
+#compdef ppmforge
+
+_arguments '-clouds' '-night' \
+           '-dimension:fractal dimension:' '-hour:hour angle:' \
+	   '-inclination:inclination angle:' \
+	   '-tilt:inclination angle:' \
+	   '-mesh:FFT mesh size:' '-power:elevations power factor:' \
+	   '-glaciers:glacier elevation:' '-ice:polar ice cap extent:' \
+	   '-saturation:star color saturation:' \
+	   '-seed:randum number seed:' \
+	   '-stars:minimum star pixel percentage:' \
+	   '-width:width:' '-xsize:width:' \
+	   '-height:height:' '-ysize:height:'
diff --git a/Completion/Pbmplus/_ppmmake b/Completion/Pbmplus/_ppmmake
new file mode 100644
index 000000000..62512a261
--- /dev/null
+++ b/Completion/Pbmplus/_ppmmake
@@ -0,0 +1,3 @@
+#compdef ppmmake
+
+_arguments ':color: _colors' ':width:' ':height:'
diff --git a/Completion/Pbmplus/_ppmmix b/Completion/Pbmplus/_ppmmix
new file mode 100644
index 000000000..bde240b75
--- /dev/null
+++ b/Completion/Pbmplus/_ppmmix
@@ -0,0 +1,3 @@
+#compdef ppmmix
+
+_arguments ':fade factor:' ':file: _pbm_file' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmntsc b/Completion/Pbmplus/_ppmntsc
new file mode 100644
index 000000000..d4583f242
--- /dev/null
+++ b/Completion/Pbmplus/_ppmntsc
@@ -0,0 +1,3 @@
+#compdef ppmntsc
+
+_arguments ':dim factor:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmpat b/Completion/Pbmplus/_ppmpat
new file mode 100644
index 000000000..e1c377c3c
--- /dev/null
+++ b/Completion/Pbmplus/_ppmpat
@@ -0,0 +1,4 @@
+#compdef ppmpat
+
+_arguments -gingham{2,3} -g{2,3} -madras -tartan -poles -squig -camo -anticamo \
+           ':width:' ':height:'
diff --git a/Completion/Pbmplus/_ppmquant b/Completion/Pbmplus/_ppmquant
new file mode 100644
index 000000000..42071d959
--- /dev/null
+++ b/Completion/Pbmplus/_ppmquant
@@ -0,0 +1,26 @@
+#compdef ppmquant
+
+local ret=1 expl opt=yes
+
+if [[ "$words[2]" = -(fs|floyd) ]]; then
+  (( CURRENT-- ))
+  shift 1 words
+  opt=''
+fi
+
+if [[ CURRENT -eq 2 ]]; then
+  _description expl option
+  if [[ -n "$opt" ]]; then
+    compadd "$expl[@]" - -map -fs -floyd && ret=0
+  else
+    compadd "$expl[@]" - -map && ret=0
+  fi
+  _message 'number of colors'
+
+  return ret
+elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then
+  _description expl 'map file'
+  _files "$expl[@]" -g '*.(#i)ppm'
+else
+  _pbm_file
+fi
diff --git a/Completion/Pbmplus/_ppmquantall b/Completion/Pbmplus/_ppmquantall
new file mode 100644
index 000000000..8fb85ab6d
--- /dev/null
+++ b/Completion/Pbmplus/_ppmquantall
@@ -0,0 +1,3 @@
+#compdef ppmquantall
+
+_arguments ':number of colors:' '*:file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmshift b/Completion/Pbmplus/_ppmshift
new file mode 100644
index 000000000..02fa9c465
--- /dev/null
+++ b/Completion/Pbmplus/_ppmshift
@@ -0,0 +1,3 @@
+#compdef ppmshift
+
+_arguments ':shift value:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmspread b/Completion/Pbmplus/_ppmspread
new file mode 100644
index 000000000..d0452ba0e
--- /dev/null
+++ b/Completion/Pbmplus/_ppmspread
@@ -0,0 +1,3 @@
+#compdef ppmspread
+
+_arguments ':maximum spread amount:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtoacad b/Completion/Pbmplus/_ppmtoacad
new file mode 100644
index 000000000..245b8afcd
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtoacad
@@ -0,0 +1,4 @@
+#compdef ppmtoacad
+
+_arguments '-dxb' '-poly' '-background:background color:_colors' \
+           '-white' '-aspect:pixel aspect ratio:' '-8' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtobmp b/Completion/Pbmplus/_ppmtobmp
new file mode 100644
index 000000000..0ebaef1f6
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtobmp
@@ -0,0 +1,3 @@
+#compdef ppmtobmp
+
+_arguments '-os2' '-windows' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtogif b/Completion/Pbmplus/_ppmtogif
new file mode 100644
index 000000000..46e0a6663
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtogif
@@ -0,0 +1,3 @@
+#compdef ppmtogif
+
+_arguments '-interlace' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtoicr b/Completion/Pbmplus/_ppmtoicr
new file mode 100644
index 000000000..4df9c26f3
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtoicr
@@ -0,0 +1,4 @@
+#compdef ppmtoicr
+
+_arguments '-windowname:window name:' '-expand:expansion factor:' \
+           '-display:display screen:' '-rle' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtoilbm b/Completion/Pbmplus/_ppmtoilbm
new file mode 100644
index 000000000..ff19fa91a
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtoilbm
@@ -0,0 +1,3 @@
+#compdef ppmtoilbm
+
+_arguments '-hamif' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtomap b/Completion/Pbmplus/_ppmtomap
new file mode 100644
index 000000000..0476cfb44
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtomap
@@ -0,0 +1,3 @@
+#compdef ppmtomap
+
+_arguments '-sort' '-square' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtomitsu b/Completion/Pbmplus/_ppmtomitsu
new file mode 100644
index 000000000..e89047df1
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtomitsu
@@ -0,0 +1,7 @@
+#compdef ppmtomitsu
+
+_arguments '-sharpness:sharpness:(1 2 3 4)' \
+           '-enlarge:enlargement factor:(1 2 3)' \
+	   '-media:output media:(A A4 AS A4S)' \
+	   '-copy:number of copies:(1 2 3 4 5 6 7 8 9)' \
+	   '-dpi300' '-tiny' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtopj b/Completion/Pbmplus/_ppmtopj
new file mode 100644
index 000000000..d5b48f5c7
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtopj
@@ -0,0 +1,6 @@
+#compdef ppmtopj
+
+_arguments '-gamma:gamma value:' '-xpos:x position:' '-rle' '-center' \
+           '-ypos:y position:' '-back:background brightness:(dark lite)' \
+	   '-render:rendering algorithm:(none snap bw dither diffuse monodither monodiffuse clusterdither monoclusterdither)' \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtopjxl b/Completion/Pbmplus/_ppmtopjxl
new file mode 100644
index 000000000..5ef79be94
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtopjxl
@@ -0,0 +1,9 @@
+#compdef ppmtopjxl
+
+_arguments '-nopack' '-gamma:gamma value:' '-presentation' '-dark' \
+           '-diffuse' '-cluster' '-dither' \
+	   '-xshift:x shift:' '-yshift:y shift:' \
+	   '-xscale:x scale factor:' '-yscale:y scale factor:' \
+	   '-xsize:width:'  '-width:width:' \
+	   '-ysize:height:' '-height:height:' \
+	   ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtosixel b/Completion/Pbmplus/_ppmtosixel
new file mode 100644
index 000000000..6272661aa
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtosixel
@@ -0,0 +1,3 @@
+#compdef ppmtosixel
+
+_arguments '-raw' '-margin' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtotga b/Completion/Pbmplus/_ppmtotga
new file mode 100644
index 000000000..adf09a2bd
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtotga
@@ -0,0 +1,3 @@
+#compdef ppmtotga
+
+_arguments '-mono' '-cmap' '-rgb' '-norle' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtouil b/Completion/Pbmplus/_ppmtouil
new file mode 100644
index 000000000..63b1ee167
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtouil
@@ -0,0 +1,3 @@
+#compdef ppmtouil ppmtoxpm
+
+_arguments '-name:name prefix:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_ppmtoyuvsplit b/Completion/Pbmplus/_ppmtoyuvsplit
new file mode 100644
index 000000000..598b78797
--- /dev/null
+++ b/Completion/Pbmplus/_ppmtoyuvsplit
@@ -0,0 +1,3 @@
+#compdef ppmtoyuvsplit
+
+_arguments ':base name:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_psidtopgm b/Completion/Pbmplus/_psidtopgm
new file mode 100644
index 000000000..0ba7328aa
--- /dev/null
+++ b/Completion/Pbmplus/_psidtopgm
@@ -0,0 +1,4 @@
+#compdef psidtopgm
+
+_arguments ':width:' ':height:' ':bits per sample:' \
+           ':postscript file:_files -g *.(#i)(ps|eps)'
diff --git a/Completion/Pbmplus/_pstopnm b/Completion/Pbmplus/_pstopnm
new file mode 100644
index 000000000..b66f4041a
--- /dev/null
+++ b/Completion/Pbmplus/_pstopnm
@@ -0,0 +1,10 @@
+#compdef pstopnm
+
+_arguments '-forceplain' '-help' '-landscape' '-portrait' '-nocrop' \
+           '-pbm' '-pgm' '-ppm' '-verbose' \
+	   '-llx:loxer left x position:' '-lly:lower left y position:' \
+	   '-urx:upper right x position:' '-ury:upper right y position:' \
+	   '-xborder:x border fraction:' '-yborder:y border fraction:' \
+	   '-xmax:maximum width:' '-ymax:maximum height' \
+	   '-xsize:width:' '-ysize:height:' \
+	   ':postscript file:_files -g *.(#i)(ps|eps)'
diff --git a/Completion/Pbmplus/_rawtopgm b/Completion/Pbmplus/_rawtopgm
new file mode 100644
index 000000000..c8e87dbde
--- /dev/null
+++ b/Completion/Pbmplus/_rawtopgm
@@ -0,0 +1,5 @@
+#compdef rawtopgm
+
+_arguments '-headerskip:header bytes to skip:' \
+           '-rowskip:row padding to skip:' \
+	   ':width:' ':height:' ':grayscale bytes:'
diff --git a/Completion/Pbmplus/_rawtoppm b/Completion/Pbmplus/_rawtoppm
new file mode 100644
index 000000000..d4a0c333c
--- /dev/null
+++ b/Completion/Pbmplus/_rawtoppm
@@ -0,0 +1,6 @@
+#compdef rawtoppm
+
+_arguments '-headerskip:header bytes to skip:' \
+           '-rowskip:row padding to skip:' \
+	   '-rgb' '-rbg' '-grb' '-gbr' '-brg' '-bgr' '-interpixel' '-interrow' \
+	   ':width:' ':height:' ':grayscale bytes:'
diff --git a/Completion/Pbmplus/_rgb3toppm b/Completion/Pbmplus/_rgb3toppm
new file mode 100644
index 000000000..ac4df434d
--- /dev/null
+++ b/Completion/Pbmplus/_rgb3toppm
@@ -0,0 +1,16 @@
+#compdef rgb3toppm
+
+local expl
+
+if [[ CURRENT -eq 2 ]]; then
+  expl='red picture file'
+elif [[ CURRENT -eq 3 ]]; then
+  expl='green picture file'
+elif [[ CURRENT -eq 4 ]]; then
+  expl='blue picture file'
+fi
+
+if [[ -n "$expl" ]]; then
+  _description expl "$expl"
+  _files "$expl" -g '*.(#i)pgm'
+fi
diff --git a/Completion/Pbmplus/_sgitopnm b/Completion/Pbmplus/_sgitopnm
new file mode 100644
index 000000000..84189acc2
--- /dev/null
+++ b/Completion/Pbmplus/_sgitopnm
@@ -0,0 +1,3 @@
+#compdef sgitopnm
+
+_arguments '-verbose' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_sldtoppm b/Completion/Pbmplus/_sldtoppm
new file mode 100644
index 000000000..0ec01860c
--- /dev/null
+++ b/Completion/Pbmplus/_sldtoppm
@@ -0,0 +1,7 @@
+#compdef sldtoppm
+
+_arguments '-adjust' '-dir' '-info' '-verbose' \
+	   '-width:width:'   '-xsize:width:' \
+           '-height:height:' '-ysize:height:' \
+	   '-scale:scale factor:' \
+	   '-lib:slide name:' '-Lib:slide name:' ':file: _pbm_file'
diff --git a/Completion/Pbmplus/_yuvsplittoppm b/Completion/Pbmplus/_yuvsplittoppm
new file mode 100644
index 000000000..83d7c4d28
--- /dev/null
+++ b/Completion/Pbmplus/_yuvsplittoppm
@@ -0,0 +1,3 @@
+#compdef yuvsplittoppm
+
+_arguments ':base name:' ':width:' ':height:' '-ccir601'
diff --git a/Completion/Pbmplus/_yuvtoppm b/Completion/Pbmplus/_yuvtoppm
new file mode 100644
index 000000000..438249d34
--- /dev/null
+++ b/Completion/Pbmplus/_yuvtoppm
@@ -0,0 +1,3 @@
+#compdef yuvtoppm
+
+_arguments ':width:' ':height:' 'image bytes:'
diff --git a/Completion/Pbmplus/_zeisstopnm b/Completion/Pbmplus/_zeisstopnm
new file mode 100644
index 000000000..f38c02b93
--- /dev/null
+++ b/Completion/Pbmplus/_zeisstopnm
@@ -0,0 +1,3 @@
+#compdef zeisstopnm
+
+_arguments '-pgm' '-ppm' ':file: _pbm_file'