Revision 3db199ea
b/autotools/build-bash-completion | ||
---|---|---|
54 | 54 |
sw.Write("# This script is automatically generated at build time.") |
55 | 55 |
sw.Write("# Do not modify manually.") |
56 | 56 |
|
57 |
sw.Write("_ganeti_dbglog() {")
|
|
57 |
sw.Write("_gnt_log() {")
|
|
58 | 58 |
sw.IncIndent() |
59 | 59 |
try: |
60 | 60 |
sw.Write("if [[ -n \"$GANETI_COMPL_LOG\" ]]; then") |
... | ... | |
192 | 192 |
|
193 | 193 |
# Params: <long options with equal sign> <all options> |
194 | 194 |
# Result variable: $optcur |
195 |
sw.Write("_ganeti_checkopt() {")
|
|
195 |
sw.Write("_gnt_checkopt() {")
|
|
196 | 196 |
sw.IncIndent() |
197 | 197 |
try: |
198 | 198 |
sw.Write("""if [[ -n "$1" && "$cur" == @($1) ]]; then""") |
... | ... | |
211 | 211 |
sw.DecIndent() |
212 | 212 |
sw.Write("fi") |
213 | 213 |
|
214 |
sw.Write("_ganeti_dbglog optcur=\"'$optcur'\"")
|
|
214 |
sw.Write("_gnt_log optcur=\"'$optcur'\"")
|
|
215 | 215 |
|
216 | 216 |
sw.Write("return 1") |
217 | 217 |
finally: |
... | ... | |
220 | 220 |
|
221 | 221 |
# Params: <compgen options> |
222 | 222 |
# Result variable: $COMPREPLY |
223 |
sw.Write("_ganeti_compgen() {")
|
|
223 |
sw.Write("_gnt_compgen() {")
|
|
224 | 224 |
sw.IncIndent() |
225 | 225 |
try: |
226 | 226 |
sw.Write("""COMPREPLY=( $(compgen "$@") )""") |
227 |
sw.Write("_ganeti_dbglog COMPREPLY=\"${COMPREPLY[@]}\"")
|
|
227 |
sw.Write("_gnt_log COMPREPLY=\"${COMPREPLY[@]}\"")
|
|
228 | 228 |
finally: |
229 | 229 |
sw.DecIndent() |
230 | 230 |
sw.Write("}") |
231 | 231 |
|
232 | 232 |
|
233 | 233 |
def WriteCompReply(sw, args, cur="\"$cur\""): |
234 |
sw.Write("_ganeti_compgen %s -- %s", args, cur)
|
|
234 |
sw.Write("_gnt_compgen %s -- %s", args, cur)
|
|
235 | 235 |
sw.Write("return") |
236 | 236 |
|
237 | 237 |
|
... | ... | |
327 | 327 |
else: |
328 | 328 |
condcmd = "if" |
329 | 329 |
|
330 |
sw.Write("%s _ganeti_checkopt %s %s; then", condcmd,
|
|
330 |
sw.Write("%s _gnt_checkopt %s %s; then", condcmd,
|
|
331 | 331 |
utils.ShellQuote("|".join(["%s=*" % i for i in longnames])), |
332 | 332 |
utils.ShellQuote("|".join(allnames))) |
333 | 333 |
sw.IncIndent() |
... | ... | |
364 | 364 |
sw.DecIndent() |
365 | 365 |
sw.Write("fi") |
366 | 366 |
|
367 |
sw.Write("_ganeti_dbglog pfx=\"'$pfx'\" curvalue=\"'$curvalue'\""
|
|
367 |
sw.Write("_gnt_log pfx=\"'$pfx'\" curvalue=\"'$curvalue'\""
|
|
368 | 368 |
" node1=\"'$node1'\"") |
369 | 369 |
|
370 | 370 |
sw.Write("for i in $(_ganeti_nodes); do") |
... | ... | |
419 | 419 |
varlen_arg_idx = None |
420 | 420 |
wrote_arg = False |
421 | 421 |
|
422 |
# Write some debug comments |
|
423 |
for idx, arg in enumerate(self.args): |
|
424 |
sw.Write("# %s: %r", idx, arg) |
|
425 |
|
|
426 | 422 |
sw.Write("compgenargs=") |
427 | 423 |
|
428 | 424 |
for idx, arg in enumerate(self.args): |
... | ... | |
531 | 527 |
' prev="${COMP_WORDS[COMP_CWORD-1]}"' |
532 | 528 |
' i first_arg_idx choices compgenargs arg_idx optcur') |
533 | 529 |
|
534 |
sw.Write("_ganeti_dbglog cur=\"$cur\" prev=\"$prev\"")
|
|
530 |
sw.Write("_gnt_log cur=\"$cur\" prev=\"$prev\"")
|
|
535 | 531 |
sw.Write("[[ -n \"$GANETI_COMPL_LOG\" ]] &&" |
536 |
" _ganeti_dbglog \"$(set | grep ^COMP_)\"")
|
|
532 |
" _gnt_log \"$(set | grep ^COMP_)\"")
|
|
537 | 533 |
|
538 | 534 |
sw.Write("COMPREPLY=()") |
539 | 535 |
|
Also available in: Unified diff