From 1f4e391b7f4fcb341aa834f6970724959af868ee Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 16 Sep 2009 17:39:03 +0200 Subject: [PATCH] Show "--help" in bash completion Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- autotools/build-bash-completion | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion index 7368dab32..cb738cdd6 100755 --- a/autotools/build-bash-completion +++ b/autotools/build-bash-completion @@ -584,6 +584,14 @@ def GetCommands(filename, module): raise Exception("Script %s doesn't have 'commands' attribute" % filename) + # Add the implicit "--help" option + help_option = cli.cli_option("-h", "--help", default=False, + action="store_true") + + for (_, _, optdef, _, _) in commands.itervalues(): + if help_option not in optdef: + optdef.append(help_option) + # Use aliases aliases = getattr(module, "aliases", {}) if aliases: -- GitLab