~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add '--help' to tab completion for all commands
[stgit]
/
stgit
/
completion.py
diff --git
a/stgit/completion.py
b/stgit/completion.py
index
e461e3b
..
affc8c6
100644
(file)
--- a/
stgit/completion.py
+++ b/
stgit/completion.py
@@
-1,6
+1,7
@@
import textwrap
import stgit.commands
from stgit import argparse
import textwrap
import stgit.commands
from stgit import argparse
+import itertools
def fun(name, *body):
return ['%s ()' % name, '{', list(body), '}']
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(
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', [
'local prev="${COMP_WORDS[COMP_CWORD-1]}"',
'local cur="${COMP_WORDS[COMP_CWORD]}"',
'case "$prev" in', [