Revision 2d3ed64b

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:
b/lib/cli.py
59 59
           "OPT_COMPL_ONE_NODE", "OPT_COMPL_ONE_INSTANCE",
60 60
           "OPT_COMPL_MANY_NODES",
61 61
           "OPT_COMPL_ONE_OS", "OPT_COMPL_ONE_IALLOCATOR",
62
           "OPT_COMPL_INST_ADD_NODES",
62 63
           ]
63 64

  
64 65
NO_PREFIX = "no_"
......
340 341
 OPT_COMPL_ONE_NODE,
341 342
 OPT_COMPL_ONE_INSTANCE,
342 343
 OPT_COMPL_ONE_OS,
343
 OPT_COMPL_ONE_IALLOCATOR) = range(100, 105)
344
 OPT_COMPL_ONE_IALLOCATOR,
345
 OPT_COMPL_INST_ADD_NODES) = range(100, 106)
344 346

  
345 347
OPT_COMPL_ALL = frozenset([
346 348
  OPT_COMPL_MANY_NODES,
......
348 350
  OPT_COMPL_ONE_INSTANCE,
349 351
  OPT_COMPL_ONE_OS,
350 352
  OPT_COMPL_ONE_IALLOCATOR,
353
  OPT_COMPL_INST_ADD_NODES,
351 354
  ])
352 355

  
353 356

  
b/scripts/gnt-backup
213 213
  DEBUG_OPT,
214 214
  cli_option("-n", "--node", dest="node",
215 215
             help="Target node and optional secondary node",
216
             metavar="<pnode>[:<snode>]"),
216
             metavar="<pnode>[:<snode>]",
217
             completion_suggest=OPT_COMPL_INST_ADD_NODES),
217 218
  cli_option("-B", "--backend", dest="beparams",
218 219
             type="keyval", default={},
219 220
             help="Backend parameters"),
b/scripts/gnt-instance
1369 1369
  DEBUG_OPT,
1370 1370
  cli_option("-n", "--node", dest="node",
1371 1371
             help="Target node and optional secondary node",
1372
             metavar="<pnode>[:<snode>]"),
1372
             metavar="<pnode>[:<snode>]",
1373
             completion_suggest=OPT_COMPL_INST_ADD_NODES),
1373 1374
  os_opt,
1374 1375
  cli_option("-B", "--backend", dest="beparams",
1375 1376
             type="keyval", default={},

Also available in: Unified diff