From: Gustav Hållberg Date: Sun, 21 Dec 2008 10:55:52 +0000 (+0100) Subject: Add '--help' to tab completion for all commands X-Git-Tag: v0.15-rc1~74 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/051e292e362875d33478136431e18c7a26ccd2f2?hp=1f60181a36c0b201b40e2c8b610cc203df048f54 Add '--help' to tab completion for all commands Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- diff --git a/stgit/completion.py b/stgit/completion.py index e461e3b..affc8c6 100644 --- a/stgit/completion.py +++ b/stgit/completion.py @@ -1,6 +1,7 @@ import textwrap import stgit.commands from stgit import argparse +import itertools def fun(name, *body): return ['%s ()' % name, '{', list(body), '}'] @@ -81,8 +82,10 @@ def command_fun(cmd, modname): return fun( '_stg_%s' % cmd, 'local flags="%s"' % ' '.join(sorted( - flag for opt in mod.options - for flag in opt.flags if flag.startswith('--'))), + itertools.chain( + ('--help',), + (flag for opt in mod.options + for flag in opt.flags if flag.startswith('--'))))), 'local prev="${COMP_WORDS[COMP_CWORD-1]}"', 'local cur="${COMP_WORDS[COMP_CWORD]}"', 'case "$prev" in', [