sw.DecIndent()
sw.Write("}")
+ sw.Write("_ganeti_network() {")
+ sw.IncIndent()
+ try:
+ networks_path = os.path.join(pathutils.DATA_DIR, "ssconf_networks")
+ sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(networks_path))
+ finally:
+ sw.DecIndent()
+ sw.Write("}")
+
# Params: <offset> <options with values> <options without values>
# Result variable: $first_arg_idx
sw.Write("_ganeti_find_first_arg() {")
WriteCompReply(sw, "-W \"$(_ganeti_iallocator)\"", cur=cur)
elif suggest == cli.OPT_COMPL_ONE_NODEGROUP:
WriteCompReply(sw, "-W \"$(_ganeti_nodegroup)\"", cur=cur)
+ elif suggest == cli.OPT_COMPL_ONE_NETWORK:
+ WriteCompReply(sw, "-W \"$(_ganeti_network)\"", cur=cur)
elif suggest == cli.OPT_COMPL_INST_ADD_NODES:
sw.Write("local tmp= node1= pfx= curvalue=\"${optcur#*:}\"")
choices = "$(_ganeti_nodes)"
elif isinstance(arg, cli.ArgGroup):
choices = "$(_ganeti_nodegroup)"
+ elif isinstance(arg, cli.ArgNetwork):
+ choices = "$(_ganeti_network)"
elif isinstance(arg, cli.ArgJobId):
choices = "$(_ganeti_jobs)"
elif isinstance(arg, cli.ArgOs):
return cli.cli_option(*opts, action="store_true")
elif kind in ["file", "string", "host", "dir", "inetaddr"]:
return cli.cli_option(*opts, type="string")
- elif kind == "numeric":
- # FIXME: float values here
- return cli.cli_option(*opts, type="string")
+ elif kind == "integer":
+ return cli.cli_option(*opts, type="int")
+ elif kind == "float":
+ return cli.cli_option(*opts, type="float")
elif kind == "onegroup":
return cli.cli_option(*opts, type="string",
completion_suggest=cli.OPT_COMPL_ONE_NODEGROUP)
#: serialised kind to arg type
_ARG_MAP = {
+ "choices": cli.ArgChoice,
"command": cli.ArgCommand,
"file": cli.ArgFile,
"host": cli.ArgHost,
"onenode": cli.ArgNode,
"oneos": cli.ArgOs,
"string": cli.ArgUnknown,
+ "suggests": cli.ArgSuggest,
}
env = {}
script_name = os.path.basename(script)
func_name = script_name
+ func_name = func_name.replace("-", "_")
output = utils.RunCmd([cmd, "--help-completion"], env=env, cwd=".").output
cli_opts = []
args = []
not options.compact,
opts=burnin.OPTIONS, args=burnin.ARGUMENTS)
+ # ganeti-cleaner
+ WriteHaskellCompletion(sw, "daemons/ganeti-cleaner", htools=False,
+ debug=not options.compact)
+
# htools, if enabled
if _autoconf.HTOOLS:
for script in _autoconf.HTOOLS_PROGS: