Revision 5b0ca9d4
b/autotools/build-bash-completion | ||
---|---|---|
80 | 80 |
sw.Write("# This script is automatically generated at build time.") |
81 | 81 |
sw.Write("# Do not modify manually.") |
82 | 82 |
|
83 |
sw.Write("_ganeti_dbglog() {") |
|
84 |
sw.IncIndent() |
|
85 |
try: |
|
86 |
sw.Write("if [[ -n \"$GANETI_COMPL_LOG\" ]]; then") |
|
87 |
sw.IncIndent() |
|
88 |
try: |
|
89 |
sw.Write("{") |
|
90 |
sw.IncIndent() |
|
91 |
try: |
|
92 |
sw.Write("echo ---") |
|
93 |
sw.Write("echo \"$@\"") |
|
94 |
sw.Write("echo") |
|
95 |
finally: |
|
96 |
sw.DecIndent() |
|
97 |
sw.Write("} >> $GANETI_COMPL_LOG") |
|
98 |
finally: |
|
99 |
sw.DecIndent() |
|
100 |
sw.Write("fi") |
|
101 |
finally: |
|
102 |
sw.DecIndent() |
|
103 |
sw.Write("}") |
|
104 |
|
|
83 | 105 |
sw.Write("_ganeti_nodes() {") |
84 | 106 |
sw.IncIndent() |
85 | 107 |
try: |
... | ... | |
206 | 228 |
sw.DecIndent() |
207 | 229 |
sw.Write("fi") |
208 | 230 |
|
231 |
sw.Write("_ganeti_dbglog optcur=\"'$optcur'\"") |
|
232 |
|
|
209 | 233 |
sw.Write("return 1") |
210 | 234 |
finally: |
211 | 235 |
sw.DecIndent() |
... | ... | |
214 | 238 |
|
215 | 239 |
def WriteCompReply(sw, args, cur="\"$cur\""): |
216 | 240 |
sw.Write("""COMPREPLY=( $(compgen %s -- %s) )""", args, cur) |
241 |
sw.Write("_ganeti_dbglog COMPREPLY=\"${COMPREPLY[@]}\"") |
|
217 | 242 |
sw.Write("return") |
218 | 243 |
|
219 | 244 |
|
... | ... | |
452 | 477 |
' prev="${COMP_WORDS[COMP_CWORD-1]}"' |
453 | 478 |
' i first_arg_idx choices compgenargs arg_idx optcur') |
454 | 479 |
|
455 |
# Useful for debugging:
|
|
456 |
#sw.Write("echo cur=\"$cur\" prev=\"$prev\"")
|
|
457 |
#sw.Write("set | grep ^COMP_")
|
|
480 |
sw.Write("_ganeti_dbglog cur=\"$cur\" prev=\"$prev\"")
|
|
481 |
sw.Write("[[ -n \"$GANETI_COMPL_LOG\" ]] &&"
|
|
482 |
" _ganeti_dbglog \"$(set | grep ^COMP_)\"")
|
|
458 | 483 |
|
459 | 484 |
sw.Write("COMPREPLY=()") |
460 | 485 |
|
Also available in: Unified diff