From 30d44392f79979e086cd6b072f7ce9bc4aec75a2 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 27 Aug 2009 19:26:36 +0200 Subject: [PATCH] Bash completion: Add function to get all iallocators Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Olivier Tharan <olive@google.com> --- autotools/build-bash-completion | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion index 1695e84d4..838b9f66a 100755 --- a/autotools/build-bash-completion +++ b/autotools/build-bash-completion @@ -112,16 +112,20 @@ def WritePreamble(sw): sw.DecIndent() sw.Write("}") - sw.Write("_ganeti_os() {") - sw.IncIndent() - try: - # FIXME: Make querying the master for all OSes cheap - for path in constants.OS_SEARCH_PATH: - sw.Write("( shopt -s nullglob && cd %s 2>/dev/null && echo * || : )", - utils.ShellQuote(path)) - finally: - sw.DecIndent() - sw.Write("}") + for (fnname, paths) in [ + ("os", constants.OS_SEARCH_PATH), + ("iallocator", constants.IALLOCATOR_SEARCH_PATH), + ]: + sw.Write("_ganeti_%s() {", fnname) + sw.IncIndent() + try: + # FIXME: Make querying the master for all OSes cheap + for path in paths: + sw.Write("( shopt -s nullglob && cd %s 2>/dev/null && echo * || : )", + utils.ShellQuote(path)) + finally: + sw.DecIndent() + sw.Write("}") # Params: <offset> <options with values> <options without values> # Result variable: $first_arg_idx -- GitLab