about summary refs log tree commit diff
path: root/Completion/X/_xutils
blob: 2162036225bf65b703b736eb8155f9e4b6f76f60 (plain) (blame)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb

case "$words[1]" in
xdpyinfo)
  _x_arguments \
    -queryExtensions \
    '-ext:extension: _x_extension -a'
  ;;
xwininfo)
  _x_arguments \
    -{help,int,stats,bits,events,size,wm,shape,frame,all,english,metric} \
    '(-id -name)-root' \
    '(-id -root)-name:name: _x_window -n' \
    '(-name -root)-id:id: _x_window'
  ;;
xkill)
  _x_arguments \
    -frame \
    '(-id)-all' \
    '(-all)-id:window: _x_window' \
    '-button:selection button:(any 1 2 3 4 5)'
  ;;
xfontsel)
  _xt_arguments \
    -{print,noscaled} \
    '-pattern:font pattern:_x_font' \
    '-sample:sample text:' \
    '-sample16:16-bit sample text:'
  ;;
xfd)
  _xt_arguments \
    '-fn:font: _x_font' \
    -{box,center} \
    '-start:first character number:' \
    '-bc:box border color:_x_color' \
    '-rows:number of rows:' \
    '-columns:number of columns:'
  ;;
xev)
  _x_arguments \
    '-bw:border width:' \
    '-bs:type of backing store:(NotUseful WhenMapped Always)' \
    '-id:id:_x_window' \
    '-s[use save-under]' \
    '-name:window name:' \
    '-rv'
  ;;
xhost)
  local expl type ret=1 tmp

  if compset -P '-'; then
    tmp=(${(f)"$(xhost)"})
    shift tmp
    tmp=(${tmp:#LOCAL:|<*>})
    if [[ "$tmp" = *:* ]]; then
      if compset -P '(#b)(*):'; then
	type="$match[1]"
	_wanted displays expl 'disallow access' &&
	    {
	      compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \
		      ${${(M)tmp:#(#i)$type:*}#(#i)$type:} ||
	      _hosts "$expl[@]"
	    }
      else
	_alternative \
	    'types:name family:compadd -S: ${(L)tmp%%:*}' \
	    'hosts:host:compadd ${(@)tmp#*:}' && ret=0
      fi
    else
      _wanted displays expl 'disallow access' &&
	  { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - $tmp || _hosts "$expl[@]" }
    fi
  else
    compset -P +

    if [[ "$PREFIX" = *:* ]]; then
      type="${(L)PREFIX%%:*}"
      compset -P '*:'

      case "$type" in
      inet) _hosts && ret=0;;
      dnet) _message 'DECnet host';;
      nis)  _message 'Secure RPC network name';;
      krb)  _message 'Kerberos V5 principal';;
      esac
    else
      _alternative \
          'types:name family:compadd -S: - inet dnet nis krb' \
	  'hosts:: _hosts' && ret=0
    fi
    return ret
  fi
  ;;
xon)
  _arguments \
    -{access,debug,nols} \
    '-name:window name:' \
    '-screen:screen number:' \
    '-user:remote user name:_users' \
    ':remote host:_hosts' \
    '*:command::command:_normal'
  ;;
xsetroot)
  _x_arguments \
    -{help,def,gray,grey,rv} \
    '-cursor:cursor file:_files -g \*.\(\#i\)\(xbm\|curs\(\|or\)\):mask file:_files -g \*.\(\#i\)\(xbm\|curs\(\|or\)\|mask\)' \
    '-cursor_name:cursor name:_x_cursor' \
    '-bitmap:bitmap file:_files -g \*.\(\#i\)xbm' \
    '-mod:x grid distance (1-16): :y grid distance (1-16):' \
    '-fg:foreground color:_x_color' \
    '-bg:background color:_x_color' \
    '-solid:screen solid color:_x_color' \
    '-name:root window name:'
  ;;
xwd)
  _x_arguments \
    -{debug,help,nobdrs,xy,frame,root,icmap,screen,silent} \
    '-out:output file:_files' \
    '-add:pixel change value:' \
    '-id:id: _x_window' \
    '-name:name: _x_window -n'
  ;;
xwud)
  _x_arguments \
    -{help,new,noclick,raw,rv,scale} \
    '-bg:background color:_x_color' \
    '-fg:foreground color:_x_color' \
    '-in:input file:_files -g \*.\(\#i\)xwd' \
    '-plane:image plane to display:' \
    '-std:standard colormap:(best default gray red blue green)' \
    '-vis:visual class:(StaticGray GrayScale StaticColor PseudoColor DirectColor TrueColor)'
  ;;
xrdb)
  _x_arguments \
    -{help,quiet,symbols,retain} \
    '(-all -screen -screens)-global' \
    '(-global -screen -screens)-all' \
    '(-global -all -screens)-screen' \
    '(-global -all -screen)-screens' \
    '-n[only display on stdout]' \
    '(-nocpp)-cpp:preprocessor program:_files -g \*\(\*\)' \
    '(-cpp)-nocpp' \
    '(-load -override -merge -remove)-query' \
    '(-query -override -merge -remove)-load' \
    '(-query -load -merge -remove)-override' \
    '(-query -load -override -remove)-merge' \
    '(-query -load -override -merge)-remove' \
    '-edit:output file:_files' \
    '-backup:backup extension:' \
    '*-D-:symbol to define:' \
    '*-U-:symbol to undefine:' \
    '*-I-:include directory:_files -/' \
    '*:defaults file:_files'
  ;;
esac