Revision 2d3ed64b autotools/build-bash-completion
b/autotools/build-bash-completion | ||
---|---|---|
339 | 339 |
WriteCompReply(sw, "-W \"$(_ganeti_os)\"", cur=cur) |
340 | 340 |
elif suggest == cli.OPT_COMPL_ONE_IALLOCATOR: |
341 | 341 |
WriteCompReply(sw, "-W \"$(_ganeti_iallocator)\"", cur=cur) |
342 |
elif suggest == cli.OPT_COMPL_INST_ADD_NODES: |
|
343 |
sw.Write("local tmp= node1= pfx= curvalue=\"${optcur#*:}\"") |
|
344 |
|
|
345 |
sw.Write("if [[ \"$optcur\" == *:* ]]; then") |
|
346 |
sw.IncIndent() |
|
347 |
try: |
|
348 |
sw.Write("node1=\"${optcur%%:*}\"") |
|
349 |
|
|
350 |
sw.Write("if [[ \"$COMP_WORDBREAKS\" != *:* ]]; then") |
|
351 |
sw.IncIndent() |
|
352 |
try: |
|
353 |
sw.Write("pfx=\"$node1:\"") |
|
354 |
finally: |
|
355 |
sw.DecIndent() |
|
356 |
sw.Write("fi") |
|
357 |
finally: |
|
358 |
sw.DecIndent() |
|
359 |
sw.Write("fi") |
|
360 |
|
|
361 |
sw.Write("_ganeti_dbglog pfx=\"'$pfx'\" curvalue=\"'$curvalue'\"" |
|
362 |
" node1=\"'$node1'\"") |
|
363 |
|
|
364 |
sw.Write("for i in $(_ganeti_nodes); do") |
|
365 |
sw.IncIndent() |
|
366 |
try: |
|
367 |
sw.Write("if [[ -z \"$node1\" ]]; then") |
|
368 |
sw.IncIndent() |
|
369 |
try: |
|
370 |
sw.Write("tmp=\"$tmp $i $i:\"") |
|
371 |
finally: |
|
372 |
sw.DecIndent() |
|
373 |
sw.Write("elif [[ \"$i\" != \"$node1\" ]]; then") |
|
374 |
sw.IncIndent() |
|
375 |
try: |
|
376 |
sw.Write("tmp=\"$tmp $i\"") |
|
377 |
finally: |
|
378 |
sw.DecIndent() |
|
379 |
sw.Write("fi") |
|
380 |
finally: |
|
381 |
sw.DecIndent() |
|
382 |
sw.Write("done") |
|
383 |
|
|
384 |
WriteCompReply(sw, "-P \"$pfx\" -W \"$tmp\"", cur="\"$curvalue\"") |
|
342 | 385 |
else: |
343 | 386 |
WriteCompReply(sw, "-W %s" % utils.ShellQuote(suggest), cur=cur) |
344 | 387 |
finally: |
Also available in: Unified diff