zsh-workers
 help / color / mirror / code / Atom feed
2c6f40a35a740e64a5fbbe88be7cf8531a876268 blob 4267 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 
#compdef gs ghostscript

local -a specs names device

device=( ${${path[1,CURRENT-1]}[(R)-sDEVICE=*]} )

if compset -N '-[-+@]'; then
  if [[ CURRENT -eq 1 ]]; then
    _pspdf
  else
    _message -e arguments 'userdict ARGUMENTS'
    return 1
  fi
elif compset -P '@'; then
  _files
else
  local curcontext="$curcontext" state line expl 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 to library file search path]:directory:_dir_list' \
    \*-{d,D}'-[define name with definition]:def:->dname' \
    \*-{s,S}'-[define name with value]:def:->sname' \
    '-u[undefine name, cancelling -d or -s]:name:->uname' \
    '-P[look first in the current directory for library files]' \
    '-c[specify postscript code]:*[-@]*:postscript (-f to end)' \
    '-o+[specify OutputFile and enable -dPATCH and -dNOPAUSE options]: :->outfile' \
    '(- *)-'{h,\?}'[display useful options and available devices]' \
    '!-f-:PostScript or PDF file:_pspdf' \
    '*:PostScript or PDF file:_pspdf' && ret=0

  [[ $state = sname ]] && compset -P '(stdout|OutputFile)=' && state=outfile
  case "$state" in
  dname)
    if [[ "$PREFIX" = *\=* ]]; then
      _message -e definition-values 'systemdict definition value'
    else
      names=( ${${(f)"$($words[1] -q -o /dev/null -DNODISPLAY -c 'systemdict { type /booleantype eq { = } if } forall')"}:#*[a-z]*} )
      _wanted boolean-definitions expl 'systemdict boolean definition' compadd -M 'm:{a-z}={A-Z}' -a names && ret=0
      names=( FirstPage LastPage
          $($words[1] -q -o /dev/null $device -DNODISPLAY -c 'currentpagedevice { type /integertype eq { = } if } forall') )
      _wanted integer-definitions expl 'currentpagedevice integer definition' compadd -S = -M 'm:{a-z}={A-Z}' -a names && ret=0
    fi
    ;;
  sname)
    if compset -P 1 '*='; then
      case "$IPREFIX" in
      *DEVICE\=)
        _wanted devices expl 'ghostscript device' \
	    compadd - ${(0)"$($words[1] -q -o /dev/null -DNODISPLAY -c 'devicenames { dup length string cvs print (\0) print } forall')"} && ret=0
        ;;
      *PAPERSIZE=)
	names=( $($words[1] -q -o /dev/null -DNODISPLAY -c 'statusdict /.pagetypenames get { = } forall ') )
	_description paper-sizes expl 'paper size'
	compadd "$expl[@]" -a names && ret=0
      ;;
      *PDFSETTINGS=)
	_description settings expl 'configuration'
	compadd "$expl[@]" /screen /ebook /printer /prepress /default && ret=0
      ;;
      *AutoRotatePages=)
	_description settings expl 'orientation selection'
	compadd "$expl[@]" /None /All /PageByPage && ret=0
      ;;
      *CompatibilityLevel=)
	_description pdf-levels expl 'PDF compatibility level'
	compadd "$expl[@]" 1.{2,3,4} && ret=0
      ;;
      *FONT=) # e.g. SUBSTFONT
	_wanted fonts expl 'font' compadd - \
	    $($words[1] -q -o /dev/null -DNODISPLAY -c '(*) { = } 256 string /Font resourceforall') && ret=0
      ;;
      *)
        _message -e values 'systemdict value'
        return 1
      ;;
      esac
    else
      _wanted definition-names expl 'systemdict name' compadd -S\= -M 'm:{a-z}={A-Z}' - \
	  DEVICE OutputFile PAPERSIZE PDFSETTINGS CompatibilityLevel stdout COLORSCREEN \
	  DITHERPPI InterpolateControl TextAlphaBits GraphicsAlphaBits PageList SUBSTFONT \
	  && ret=0
    fi
    ;;
  uname)
    _message -e definition-names 'systemdict definition name'
  ;;
  outfile)
    if compset -P "*%"; then
      specs=(
	{d,i}':signed decimal number or with leading " numeric value of following character'
	'o:unsigned octal number'
	'u:unsigned decimal number'
	{x,X}':unsigned hexadecimal number, letters capitalized as x'
	'%:a literal percent sign'
	'#:alternate form'
	'0:zero pad to length'
	'-:left adjust result'
	'+:always place sign before number'
	'.:precision'
      )
      if ! compset -P '[0-9#.+-]##'; then
	specs+=(
	  'stdout:redirect to standard output'
	  'stderr:redirect to standard error'
	  'pipe%:redirect to a pipe'
	)
      fi
      _describe -t print-format-specifiers 'print format specifier' specs -S '' && ret=0
    else
      _description files expl 'output file'
      _files "$expl[@]" && ret=0
    fi
  ;;
  esac

  return ret
fi
debug log:

solving 2c6f40a35 ...
found 2c6f40a35 in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).