@libtmux/workspace-cli 0.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +330 -0
- package/THIRD-PARTY-NOTICES.md +183 -0
- package/dist/app-w7cbtf0n.js +747 -0
- package/dist/completions-2a9fqwq3.js +282 -0
- package/dist/extensions-8v6mfszj.js +268 -0
- package/dist/index-0j386v40.js +7112 -0
- package/dist/main-1de529jm.js +37 -0
- package/dist/main-bfnr2nkj.js +3106 -0
- package/dist/main-c8atq2pj.js +470 -0
- package/dist/main-gh3pafqb.js +369 -0
- package/dist/main.js +35 -0
- package/dist/progress-n08zapg2.js +1649 -0
- package/dist/reference-ebfxh6yp.js +90 -0
- package/dist/tmux-wa2zn8z1.js +893 -0
- package/docs/command-reference.md +227 -0
- package/docs/commands.json +1125 -0
- package/docs/completions/_tmux-workspace +239 -0
- package/docs/completions/tmux-workspace.bash +257 -0
- package/docs/completions/tmux-workspace.fish +430 -0
- package/package.json +49 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
#compdef tmux-workspace
|
|
2
|
+
_tmux_workspace_lookup() {
|
|
3
|
+
kind=; files=; many=0; next=-1; candidates=()
|
|
4
|
+
case "$node:$1" in
|
|
5
|
+
'0:-V'|'0:--version') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
6
|
+
'0:--log-level') kind='required'; files=''; many=0; next=-1; candidates=('debug' 'info' 'warning' 'error' 'critical');;
|
|
7
|
+
'0:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
8
|
+
'0:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
9
|
+
'0:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
10
|
+
'0:-h'|'0:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
11
|
+
'0:>load') kind='command'; files=''; many=0; next=1; candidates=();;
|
|
12
|
+
'0:>shell') kind='command'; files=''; many=0; next=2; candidates=();;
|
|
13
|
+
'0:>import') kind='command'; files=''; many=0; next=3; candidates=();;
|
|
14
|
+
'0:>convert') kind='command'; files=''; many=0; next=6; candidates=();;
|
|
15
|
+
'0:>debug-info') kind='command'; files=''; many=0; next=7; candidates=();;
|
|
16
|
+
'0:>ls') kind='command'; files=''; many=0; next=8; candidates=();;
|
|
17
|
+
'0:>search') kind='command'; files=''; many=0; next=9; candidates=();;
|
|
18
|
+
'0:>edit') kind='command'; files=''; many=0; next=10; candidates=();;
|
|
19
|
+
'0:>freeze') kind='command'; files=''; many=0; next=11; candidates=();;
|
|
20
|
+
'0:>completion') kind='command'; files=''; many=0; next=12; candidates=();;
|
|
21
|
+
'0:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-V' '--version' '--log-level' '--color' '--json' '--ndjson' '-h' '--help');;
|
|
22
|
+
'0:commands') kind='commands'; files=''; many=0; next=-1; candidates=('load' 'shell' 'import' 'convert' 'debug-info' 'ls' 'search' 'edit' 'freeze' 'completion');;
|
|
23
|
+
'1:-L') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
24
|
+
'1:-S') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
25
|
+
'1:-f') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
26
|
+
'1:-s') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
27
|
+
'1:-y'|'1:--yes') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
28
|
+
'1:-d') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
29
|
+
'1:-a'|'1:--append') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
30
|
+
'1:-2') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
31
|
+
'1:-8') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
32
|
+
'1:--log-file') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
33
|
+
'1:--progress-format') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
34
|
+
'1:--progress-lines') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
35
|
+
'1:--no-progress') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
36
|
+
'1:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
37
|
+
'1:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
38
|
+
'1:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
39
|
+
'1:-h'|'1:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
40
|
+
'1:@0') kind='argument'; files='file'; many=1; next=-1; candidates=();;
|
|
41
|
+
'1:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-L' '-S' '-f' '-s' '-y' '--yes' '-d' '-a' '--append' '-2' '-8' '--log-file' '--progress-format' '--progress-lines' '--no-progress' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
42
|
+
'1:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
43
|
+
'2:-S') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
44
|
+
'2:-L') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
45
|
+
'2:-c') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
46
|
+
'2:--best') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
47
|
+
'2:--pdb') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
48
|
+
'2:--code') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
49
|
+
'2:--ptipython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
50
|
+
'2:--ptpython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
51
|
+
'2:--ipython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
52
|
+
'2:--bpython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
53
|
+
'2:--use-pythonrc') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
54
|
+
'2:--no-startup') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
55
|
+
'2:--use-vi-mode') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
56
|
+
'2:--no-vi-mode') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
57
|
+
'2:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
58
|
+
'2:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
59
|
+
'2:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
60
|
+
'2:-h'|'2:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
61
|
+
'2:@0') kind='argument'; files=''; many=0; next=-1; candidates=();;
|
|
62
|
+
'2:@1') kind='argument'; files=''; many=0; next=-1; candidates=();;
|
|
63
|
+
'2:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-S' '-L' '-c' '--best' '--pdb' '--code' '--ptipython' '--ptpython' '--ipython' '--bpython' '--use-pythonrc' '--no-startup' '--use-vi-mode' '--no-vi-mode' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
64
|
+
'2:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
65
|
+
'3:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
66
|
+
'3:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
67
|
+
'3:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
68
|
+
'3:-h'|'3:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
69
|
+
'3:>teamocil') kind='command'; files=''; many=0; next=4; candidates=();;
|
|
70
|
+
'3:>tmuxinator') kind='command'; files=''; many=0; next=5; candidates=();;
|
|
71
|
+
'3:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
72
|
+
'3:commands') kind='commands'; files=''; many=0; next=-1; candidates=('teamocil' 'tmuxinator');;
|
|
73
|
+
'4:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
74
|
+
'4:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
75
|
+
'4:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
76
|
+
'4:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
77
|
+
'4:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
78
|
+
'4:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
79
|
+
'4:-h'|'4:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
80
|
+
'4:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
81
|
+
'4:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '--save-to' '--workspace-format' '--force' '-h' '--help');;
|
|
82
|
+
'4:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
83
|
+
'5:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
84
|
+
'5:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
85
|
+
'5:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
86
|
+
'5:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
87
|
+
'5:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
88
|
+
'5:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
89
|
+
'5:-h'|'5:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
90
|
+
'5:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
91
|
+
'5:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '--save-to' '--workspace-format' '--force' '-h' '--help');;
|
|
92
|
+
'5:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
93
|
+
'6:-y'|'6:--yes') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
94
|
+
'6:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
95
|
+
'6:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
96
|
+
'6:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
97
|
+
'6:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
98
|
+
'6:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
99
|
+
'6:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
100
|
+
'6:-h'|'6:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
101
|
+
'6:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
102
|
+
'6:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-y' '--yes' '--json' '--ndjson' '--color' '--save-to' '--workspace-format' '--force' '-h' '--help');;
|
|
103
|
+
'6:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
104
|
+
'7:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
105
|
+
'7:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
106
|
+
'7:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
107
|
+
'7:-h'|'7:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
108
|
+
'7:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
109
|
+
'7:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
110
|
+
'8:--tree') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
111
|
+
'8:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
112
|
+
'8:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
113
|
+
'8:--full') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
114
|
+
'8:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
115
|
+
'8:-h'|'8:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
116
|
+
'8:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--tree' '--json' '--ndjson' '--full' '--color' '-h' '--help');;
|
|
117
|
+
'8:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
118
|
+
'9:-f'|'9:--field') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
119
|
+
'9:-i'|'9:--ignore-case') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
120
|
+
'9:-S'|'9:--smart-case') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
121
|
+
'9:-F'|'9:--fixed-strings') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
122
|
+
'9:-w'|'9:--word-regexp') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
123
|
+
'9:-v'|'9:--invert-match') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
124
|
+
'9:--any') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
125
|
+
'9:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
126
|
+
'9:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
127
|
+
'9:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
128
|
+
'9:-h'|'9:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
129
|
+
'9:@0') kind='argument'; files=''; many=1; next=-1; candidates=();;
|
|
130
|
+
'9:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-f' '--field' '-i' '--ignore-case' '-S' '--smart-case' '-F' '--fixed-strings' '-w' '--word-regexp' '-v' '--invert-match' '--any' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
131
|
+
'9:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
132
|
+
'10:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
133
|
+
'10:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
134
|
+
'10:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
135
|
+
'10:-h'|'10:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
136
|
+
'10:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
137
|
+
'10:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
138
|
+
'10:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
139
|
+
'11:-S') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
140
|
+
'11:-L') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
141
|
+
'11:-f'|'11:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
142
|
+
'11:-o'|'11:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
143
|
+
'11:-y'|'11:--yes') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
144
|
+
'11:-q'|'11:--quiet') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
145
|
+
'11:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
146
|
+
'11:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
147
|
+
'11:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
148
|
+
'11:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
149
|
+
'11:-h'|'11:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
150
|
+
'11:@0') kind='argument'; files=''; many=0; next=-1; candidates=();;
|
|
151
|
+
'11:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-S' '-L' '-f' '--workspace-format' '-o' '--save-to' '-y' '--yes' '-q' '--quiet' '--force' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
152
|
+
'11:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
153
|
+
'12:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
154
|
+
'12:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
155
|
+
'12:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
156
|
+
'12:-h'|'12:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
157
|
+
'12:@0') kind='argument'; files=''; many=0; next=-1; candidates=('bash' 'zsh' 'fish');;
|
|
158
|
+
'12:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
159
|
+
'12:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
160
|
+
esac
|
|
161
|
+
}
|
|
162
|
+
_tmux_workspace() {
|
|
163
|
+
setopt localoptions KSH_ARRAYS
|
|
164
|
+
local -a words=("${words[@]}")
|
|
165
|
+
local end=$((CURRENT - 1))
|
|
166
|
+
local node=0 pos=0 stop=0 pending= kind= files= many=0 next=-1
|
|
167
|
+
local w key tail prefix= cur candidate i
|
|
168
|
+
local -a candidates=()
|
|
169
|
+
for ((i=1; i<end; i++)); do
|
|
170
|
+
w=${words[i]}
|
|
171
|
+
if [[ -n $pending ]]; then
|
|
172
|
+
if [[ $pending == required || $w != -* || $w == - ]]; then
|
|
173
|
+
[[ $many == 1 ]] && pending=optional || pending=
|
|
174
|
+
continue
|
|
175
|
+
fi
|
|
176
|
+
pending=
|
|
177
|
+
fi
|
|
178
|
+
if [[ $stop == 0 && $w == -- ]]; then stop=1; continue; fi
|
|
179
|
+
if [[ $stop == 0 && $w == --* ]]; then
|
|
180
|
+
key=${w%%=*}; _tmux_workspace_lookup "$key"
|
|
181
|
+
if [[ $kind == required || $kind == optional ]]; then
|
|
182
|
+
if [[ $w == *=* ]]; then [[ $many == 1 ]] && pending=optional; else pending=$kind; fi
|
|
183
|
+
fi
|
|
184
|
+
continue
|
|
185
|
+
fi
|
|
186
|
+
if [[ $stop == 0 && $w == -?* ]]; then
|
|
187
|
+
tail=${w#-}
|
|
188
|
+
while [[ -n $tail ]]; do
|
|
189
|
+
key=-${tail:0:1}; tail=${tail:1}; _tmux_workspace_lookup "$key"
|
|
190
|
+
if [[ $kind == required || $kind == optional ]]; then
|
|
191
|
+
if [[ -n $tail ]]; then [[ $many == 1 ]] && pending=optional; else pending=$kind; fi
|
|
192
|
+
break
|
|
193
|
+
fi
|
|
194
|
+
done
|
|
195
|
+
continue
|
|
196
|
+
fi
|
|
197
|
+
if [[ $stop == 0 && $pos == 0 ]]; then
|
|
198
|
+
_tmux_workspace_lookup ">$w"
|
|
199
|
+
if [[ $next -ge 0 ]]; then node=$next; pos=0; continue; fi
|
|
200
|
+
fi
|
|
201
|
+
_tmux_workspace_lookup "@$pos"
|
|
202
|
+
[[ $many == 1 ]] || pos=$((pos + 1))
|
|
203
|
+
done
|
|
204
|
+
cur=${words[end]}
|
|
205
|
+
if [[ $pending == optional && $cur == -?* ]]; then pending=; fi
|
|
206
|
+
if [[ -z $pending && $stop == 0 && $cur == --*=* ]]; then
|
|
207
|
+
key=${cur%%=*}; _tmux_workspace_lookup "$key"
|
|
208
|
+
if [[ $kind == required || $kind == optional ]]; then prefix=$key=; cur=${cur#*=}; pending=$kind; fi
|
|
209
|
+
elif [[ -z $pending && $stop == 0 && $cur == -?* && $cur != --* ]]; then
|
|
210
|
+
tail=${cur#-}; prefix=-
|
|
211
|
+
while [[ -n $tail ]]; do
|
|
212
|
+
key=-${tail:0:1}; prefix=$prefix${tail:0:1}; tail=${tail:1}; _tmux_workspace_lookup "$key"
|
|
213
|
+
if [[ $kind == required || $kind == optional ]]; then cur=$tail; pending=$kind; break; fi
|
|
214
|
+
done
|
|
215
|
+
[[ -n $pending ]] || prefix=
|
|
216
|
+
fi
|
|
217
|
+
if [[ -z $pending ]]; then
|
|
218
|
+
if [[ $stop == 0 && $cur == -* ]]; then
|
|
219
|
+
_tmux_workspace_lookup flags
|
|
220
|
+
else
|
|
221
|
+
_tmux_workspace_lookup "@$pos"
|
|
222
|
+
if [[ $stop == 0 && $pos == 0 ]]; then
|
|
223
|
+
local -a positional=("${candidates[@]}")
|
|
224
|
+
local positional_files=$files
|
|
225
|
+
_tmux_workspace_lookup commands
|
|
226
|
+
candidates+=("${positional[@]}"); files=$positional_files
|
|
227
|
+
fi
|
|
228
|
+
fi
|
|
229
|
+
fi
|
|
230
|
+
unsetopt KSH_ARRAYS
|
|
231
|
+
if (( ${#candidates[@]} )); then compadd -p "$prefix" -- "${candidates[@]}"; fi
|
|
232
|
+
if [[ -n $files ]]; then
|
|
233
|
+
[[ -z $prefix ]] || compset -P "$prefix"
|
|
234
|
+
if [[ $files == directory ]]; then _files -/; else _files; fi
|
|
235
|
+
fi
|
|
236
|
+
return 0
|
|
237
|
+
}
|
|
238
|
+
compdef _tmux_workspace 'tmux-workspace'
|
|
239
|
+
if [[ ${funcstack[1]} == '_tmux-workspace' ]]; then _tmux_workspace; fi
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Bash 3.2 or newer.
|
|
2
|
+
_tmux_workspace_lookup() {
|
|
3
|
+
kind=; files=; many=0; next=-1; candidates=()
|
|
4
|
+
case "$node:$1" in
|
|
5
|
+
'0:-V'|'0:--version') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
6
|
+
'0:--log-level') kind='required'; files=''; many=0; next=-1; candidates=('debug' 'info' 'warning' 'error' 'critical');;
|
|
7
|
+
'0:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
8
|
+
'0:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
9
|
+
'0:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
10
|
+
'0:-h'|'0:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
11
|
+
'0:>load') kind='command'; files=''; many=0; next=1; candidates=();;
|
|
12
|
+
'0:>shell') kind='command'; files=''; many=0; next=2; candidates=();;
|
|
13
|
+
'0:>import') kind='command'; files=''; many=0; next=3; candidates=();;
|
|
14
|
+
'0:>convert') kind='command'; files=''; many=0; next=6; candidates=();;
|
|
15
|
+
'0:>debug-info') kind='command'; files=''; many=0; next=7; candidates=();;
|
|
16
|
+
'0:>ls') kind='command'; files=''; many=0; next=8; candidates=();;
|
|
17
|
+
'0:>search') kind='command'; files=''; many=0; next=9; candidates=();;
|
|
18
|
+
'0:>edit') kind='command'; files=''; many=0; next=10; candidates=();;
|
|
19
|
+
'0:>freeze') kind='command'; files=''; many=0; next=11; candidates=();;
|
|
20
|
+
'0:>completion') kind='command'; files=''; many=0; next=12; candidates=();;
|
|
21
|
+
'0:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-V' '--version' '--log-level' '--color' '--json' '--ndjson' '-h' '--help');;
|
|
22
|
+
'0:commands') kind='commands'; files=''; many=0; next=-1; candidates=('load' 'shell' 'import' 'convert' 'debug-info' 'ls' 'search' 'edit' 'freeze' 'completion');;
|
|
23
|
+
'1:-L') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
24
|
+
'1:-S') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
25
|
+
'1:-f') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
26
|
+
'1:-s') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
27
|
+
'1:-y'|'1:--yes') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
28
|
+
'1:-d') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
29
|
+
'1:-a'|'1:--append') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
30
|
+
'1:-2') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
31
|
+
'1:-8') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
32
|
+
'1:--log-file') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
33
|
+
'1:--progress-format') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
34
|
+
'1:--progress-lines') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
35
|
+
'1:--no-progress') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
36
|
+
'1:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
37
|
+
'1:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
38
|
+
'1:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
39
|
+
'1:-h'|'1:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
40
|
+
'1:@0') kind='argument'; files='file'; many=1; next=-1; candidates=();;
|
|
41
|
+
'1:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-L' '-S' '-f' '-s' '-y' '--yes' '-d' '-a' '--append' '-2' '-8' '--log-file' '--progress-format' '--progress-lines' '--no-progress' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
42
|
+
'1:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
43
|
+
'2:-S') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
44
|
+
'2:-L') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
45
|
+
'2:-c') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
46
|
+
'2:--best') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
47
|
+
'2:--pdb') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
48
|
+
'2:--code') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
49
|
+
'2:--ptipython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
50
|
+
'2:--ptpython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
51
|
+
'2:--ipython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
52
|
+
'2:--bpython') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
53
|
+
'2:--use-pythonrc') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
54
|
+
'2:--no-startup') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
55
|
+
'2:--use-vi-mode') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
56
|
+
'2:--no-vi-mode') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
57
|
+
'2:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
58
|
+
'2:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
59
|
+
'2:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
60
|
+
'2:-h'|'2:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
61
|
+
'2:@0') kind='argument'; files=''; many=0; next=-1; candidates=();;
|
|
62
|
+
'2:@1') kind='argument'; files=''; many=0; next=-1; candidates=();;
|
|
63
|
+
'2:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-S' '-L' '-c' '--best' '--pdb' '--code' '--ptipython' '--ptpython' '--ipython' '--bpython' '--use-pythonrc' '--no-startup' '--use-vi-mode' '--no-vi-mode' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
64
|
+
'2:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
65
|
+
'3:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
66
|
+
'3:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
67
|
+
'3:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
68
|
+
'3:-h'|'3:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
69
|
+
'3:>teamocil') kind='command'; files=''; many=0; next=4; candidates=();;
|
|
70
|
+
'3:>tmuxinator') kind='command'; files=''; many=0; next=5; candidates=();;
|
|
71
|
+
'3:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
72
|
+
'3:commands') kind='commands'; files=''; many=0; next=-1; candidates=('teamocil' 'tmuxinator');;
|
|
73
|
+
'4:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
74
|
+
'4:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
75
|
+
'4:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
76
|
+
'4:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
77
|
+
'4:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
78
|
+
'4:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
79
|
+
'4:-h'|'4:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
80
|
+
'4:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
81
|
+
'4:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '--save-to' '--workspace-format' '--force' '-h' '--help');;
|
|
82
|
+
'4:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
83
|
+
'5:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
84
|
+
'5:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
85
|
+
'5:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
86
|
+
'5:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
87
|
+
'5:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
88
|
+
'5:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
89
|
+
'5:-h'|'5:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
90
|
+
'5:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
91
|
+
'5:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '--save-to' '--workspace-format' '--force' '-h' '--help');;
|
|
92
|
+
'5:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
93
|
+
'6:-y'|'6:--yes') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
94
|
+
'6:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
95
|
+
'6:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
96
|
+
'6:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
97
|
+
'6:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
98
|
+
'6:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
99
|
+
'6:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
100
|
+
'6:-h'|'6:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
101
|
+
'6:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
102
|
+
'6:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-y' '--yes' '--json' '--ndjson' '--color' '--save-to' '--workspace-format' '--force' '-h' '--help');;
|
|
103
|
+
'6:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
104
|
+
'7:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
105
|
+
'7:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
106
|
+
'7:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
107
|
+
'7:-h'|'7:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
108
|
+
'7:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
109
|
+
'7:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
110
|
+
'8:--tree') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
111
|
+
'8:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
112
|
+
'8:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
113
|
+
'8:--full') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
114
|
+
'8:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
115
|
+
'8:-h'|'8:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
116
|
+
'8:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--tree' '--json' '--ndjson' '--full' '--color' '-h' '--help');;
|
|
117
|
+
'8:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
118
|
+
'9:-f'|'9:--field') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
119
|
+
'9:-i'|'9:--ignore-case') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
120
|
+
'9:-S'|'9:--smart-case') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
121
|
+
'9:-F'|'9:--fixed-strings') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
122
|
+
'9:-w'|'9:--word-regexp') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
123
|
+
'9:-v'|'9:--invert-match') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
124
|
+
'9:--any') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
125
|
+
'9:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
126
|
+
'9:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
127
|
+
'9:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
128
|
+
'9:-h'|'9:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
129
|
+
'9:@0') kind='argument'; files=''; many=1; next=-1; candidates=();;
|
|
130
|
+
'9:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-f' '--field' '-i' '--ignore-case' '-S' '--smart-case' '-F' '--fixed-strings' '-w' '--word-regexp' '-v' '--invert-match' '--any' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
131
|
+
'9:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
132
|
+
'10:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
133
|
+
'10:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
134
|
+
'10:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
135
|
+
'10:-h'|'10:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
136
|
+
'10:@0') kind='argument'; files='file'; many=0; next=-1; candidates=();;
|
|
137
|
+
'10:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
138
|
+
'10:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
139
|
+
'11:-S') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
140
|
+
'11:-L') kind='required'; files=''; many=0; next=-1; candidates=();;
|
|
141
|
+
'11:-f'|'11:--workspace-format') kind='required'; files=''; many=0; next=-1; candidates=('yaml' 'json');;
|
|
142
|
+
'11:-o'|'11:--save-to') kind='required'; files='file'; many=0; next=-1; candidates=();;
|
|
143
|
+
'11:-y'|'11:--yes') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
144
|
+
'11:-q'|'11:--quiet') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
145
|
+
'11:--force') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
146
|
+
'11:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
147
|
+
'11:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
148
|
+
'11:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
149
|
+
'11:-h'|'11:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
150
|
+
'11:@0') kind='argument'; files=''; many=0; next=-1; candidates=();;
|
|
151
|
+
'11:flags') kind='flags'; files=''; many=0; next=-1; candidates=('-S' '-L' '-f' '--workspace-format' '-o' '--save-to' '-y' '--yes' '-q' '--quiet' '--force' '--json' '--ndjson' '--color' '-h' '--help');;
|
|
152
|
+
'11:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
153
|
+
'12:--json') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
154
|
+
'12:--ndjson') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
155
|
+
'12:--color') kind='required'; files=''; many=0; next=-1; candidates=('auto' 'always' 'never');;
|
|
156
|
+
'12:-h'|'12:--help') kind='none'; files=''; many=0; next=-1; candidates=();;
|
|
157
|
+
'12:@0') kind='argument'; files=''; many=0; next=-1; candidates=('bash' 'zsh' 'fish');;
|
|
158
|
+
'12:flags') kind='flags'; files=''; many=0; next=-1; candidates=('--json' '--ndjson' '--color' '-h' '--help');;
|
|
159
|
+
'12:commands') kind='commands'; files=''; many=0; next=-1; candidates=();;
|
|
160
|
+
esac
|
|
161
|
+
}
|
|
162
|
+
_tmux_workspace() {
|
|
163
|
+
local -a words=()
|
|
164
|
+
local raw line=$COMP_LINE join_next=0 end=-1 index trim=
|
|
165
|
+
for ((index=0; index<=COMP_CWORD; index++)); do
|
|
166
|
+
raw=${COMP_WORDS[index]}
|
|
167
|
+
if [[ -n $raw && $raw != *[!=:]* ]]; then
|
|
168
|
+
if [[ $end -lt 1 || $line == [[:blank:]]* ]]; then end=$((end + 1)); fi
|
|
169
|
+
words[end]=${words[end]}$raw
|
|
170
|
+
line=${line#*"$raw"}
|
|
171
|
+
join_next=1
|
|
172
|
+
[[ $line == [[:blank:]]* ]] && join_next=0
|
|
173
|
+
else
|
|
174
|
+
[[ $join_next == 1 ]] || end=$((end + 1))
|
|
175
|
+
words[end]=${words[end]}$raw
|
|
176
|
+
line=${line#*"$raw"}
|
|
177
|
+
join_next=0
|
|
178
|
+
fi
|
|
179
|
+
done
|
|
180
|
+
raw=${COMP_WORDS[COMP_CWORD]}
|
|
181
|
+
if [[ -n $raw && $raw != *[!=:]* ]]; then trim=${words[end]}; else trim=${words[end]%"$raw"}; fi
|
|
182
|
+
COMPREPLY=()
|
|
183
|
+
local node=0 pos=0 stop=0 pending= kind= files= many=0 next=-1
|
|
184
|
+
local w key tail prefix= cur candidate i
|
|
185
|
+
local -a candidates=()
|
|
186
|
+
for ((i=1; i<end; i++)); do
|
|
187
|
+
w=${words[i]}
|
|
188
|
+
if [[ -n $pending ]]; then
|
|
189
|
+
if [[ $pending == required || $w != -* || $w == - ]]; then
|
|
190
|
+
[[ $many == 1 ]] && pending=optional || pending=
|
|
191
|
+
continue
|
|
192
|
+
fi
|
|
193
|
+
pending=
|
|
194
|
+
fi
|
|
195
|
+
if [[ $stop == 0 && $w == -- ]]; then stop=1; continue; fi
|
|
196
|
+
if [[ $stop == 0 && $w == --* ]]; then
|
|
197
|
+
key=${w%%=*}; _tmux_workspace_lookup "$key"
|
|
198
|
+
if [[ $kind == required || $kind == optional ]]; then
|
|
199
|
+
if [[ $w == *=* ]]; then [[ $many == 1 ]] && pending=optional; else pending=$kind; fi
|
|
200
|
+
fi
|
|
201
|
+
continue
|
|
202
|
+
fi
|
|
203
|
+
if [[ $stop == 0 && $w == -?* ]]; then
|
|
204
|
+
tail=${w#-}
|
|
205
|
+
while [[ -n $tail ]]; do
|
|
206
|
+
key=-${tail:0:1}; tail=${tail:1}; _tmux_workspace_lookup "$key"
|
|
207
|
+
if [[ $kind == required || $kind == optional ]]; then
|
|
208
|
+
if [[ -n $tail ]]; then [[ $many == 1 ]] && pending=optional; else pending=$kind; fi
|
|
209
|
+
break
|
|
210
|
+
fi
|
|
211
|
+
done
|
|
212
|
+
continue
|
|
213
|
+
fi
|
|
214
|
+
if [[ $stop == 0 && $pos == 0 ]]; then
|
|
215
|
+
_tmux_workspace_lookup ">$w"
|
|
216
|
+
if [[ $next -ge 0 ]]; then node=$next; pos=0; continue; fi
|
|
217
|
+
fi
|
|
218
|
+
_tmux_workspace_lookup "@$pos"
|
|
219
|
+
[[ $many == 1 ]] || pos=$((pos + 1))
|
|
220
|
+
done
|
|
221
|
+
cur=${words[end]}
|
|
222
|
+
if [[ $pending == optional && $cur == -?* ]]; then pending=; fi
|
|
223
|
+
if [[ -z $pending && $stop == 0 && $cur == --*=* ]]; then
|
|
224
|
+
key=${cur%%=*}; _tmux_workspace_lookup "$key"
|
|
225
|
+
if [[ $kind == required || $kind == optional ]]; then prefix=$key=; cur=${cur#*=}; pending=$kind; fi
|
|
226
|
+
elif [[ -z $pending && $stop == 0 && $cur == -?* && $cur != --* ]]; then
|
|
227
|
+
tail=${cur#-}; prefix=-
|
|
228
|
+
while [[ -n $tail ]]; do
|
|
229
|
+
key=-${tail:0:1}; prefix=$prefix${tail:0:1}; tail=${tail:1}; _tmux_workspace_lookup "$key"
|
|
230
|
+
if [[ $kind == required || $kind == optional ]]; then cur=$tail; pending=$kind; break; fi
|
|
231
|
+
done
|
|
232
|
+
[[ -n $pending ]] || prefix=
|
|
233
|
+
fi
|
|
234
|
+
if [[ -z $pending ]]; then
|
|
235
|
+
if [[ $stop == 0 && $cur == -* ]]; then
|
|
236
|
+
_tmux_workspace_lookup flags
|
|
237
|
+
else
|
|
238
|
+
_tmux_workspace_lookup "@$pos"
|
|
239
|
+
if [[ $stop == 0 && $pos == 0 ]]; then
|
|
240
|
+
local -a positional=("${candidates[@]}")
|
|
241
|
+
local positional_files=$files
|
|
242
|
+
_tmux_workspace_lookup commands
|
|
243
|
+
candidates+=("${positional[@]}"); files=$positional_files
|
|
244
|
+
fi
|
|
245
|
+
fi
|
|
246
|
+
fi
|
|
247
|
+
for candidate in "${candidates[@]}"; do
|
|
248
|
+
if [[ $candidate == "$cur"* ]]; then candidate=$prefix$candidate; COMPREPLY+=("${candidate#"$trim"}"); fi
|
|
249
|
+
done
|
|
250
|
+
if [[ -n $files ]]; then
|
|
251
|
+
local action=file
|
|
252
|
+
[[ $files == directory ]] && action=directory
|
|
253
|
+
while IFS= read -r candidate; do candidate=$prefix$candidate; COMPREPLY+=("${candidate#"$trim"}"); done < <(compgen -A "$action" -- "$cur")
|
|
254
|
+
fi
|
|
255
|
+
return 0
|
|
256
|
+
}
|
|
257
|
+
complete -o filenames -F _tmux_workspace 'tmux-workspace'
|