Commit f8d01158 authored by Iustin Pop's avatar Iustin Pop

Enable bash completion for Haskell daemons too

This requires a few tiny changes to build-bash-completion and to
Makefile rules, but is straightforward.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 22278fa7
......@@ -182,7 +182,7 @@ HTOOLS_GENERATED_FILES =
if WANT_HTOOLS
HTOOLS_GENERATED_FILES += $(HS_PROGS)
if ENABLE_CONFD
HTOOLS_GENERATED_FILES += htools/hconfd
HTOOLS_GENERATED_FILES += htools/hconfd htools/ganeti-confd
endif
endif
......
......@@ -27,6 +27,7 @@
# [C0103] Invalid name build-bash-completion
import os
import os.path
import re
import itertools
import optparse
......@@ -641,7 +642,7 @@ def HaskellOptToOptParse(opts, kind):
opts = opts.split(",")
if kind == "none":
return cli.cli_option(*opts, action="store_true")
elif kind in ["file", "string", "host", "dir"]:
elif kind in ["file", "string", "host", "dir", "inetaddr"]:
return cli.cli_option(*opts, type="string")
elif kind == "numeric":
# FIXME: float values here
......@@ -718,11 +719,10 @@ def WriteHaskellCompletion(sw, script, htools=True, debug=True):
script_name = script
func_name = "htools_%s" % script
else:
# note: this is not yet used (daemons)
cmd = script
cmd = "./" + script
env = {}
script_name = script
func_name = script
script_name = os.path.basename(script)
func_name = script_name
output = utils.RunCmd([cmd, "--help-completion"], env=env, cwd=".").output
cli_opts = []
args = []
......@@ -786,6 +786,11 @@ def main():
WriteHaskellCompletion(sw, script, htools=True,
debug=not options.compact)
# ganeti-confd, if enabled
if _autoconf.ENABLE_CONFD:
WriteHaskellCompletion(sw, "htools/ganeti-confd", htools=False,
debug=not options.compact)
# Reset extglob to original value
sw.Write("[[ -n \"$gnt_shopt_extglob\" ]] && $gnt_shopt_extglob")
sw.Write("unset gnt_shopt_extglob")
......
......@@ -17,7 +17,7 @@ mv $tmpdir/lib $tmpdir/ganeti
ln -T -s $tmpdir/ganeti $tmpdir/lib
mkdir -p $tmpdir/htools $tmpdir/htest
for hfile in htools; do
for hfile in htools ganeti-confd; do
if [ -e htools/$hfile ]; then
cp -p htools/$hfile $tmpdir/htools/
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment