"stg <tab>" lists all commands, including "help", "version", and
"copyright".
"stg he<tab>" completes "stg help "
"stg ver<tab>" completes "stg version "
"stg copy<tab>" completes "stg copyright "
"stg help <tab>" lists all commands /other than/ help, version, and
copyright.
"stg version <tab>" goes directly to shell completion.
"stg copyright <tab>" goes directly to shell completion.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
('# Complete name of subcommand if the user has not finished'
' typing it yet.'),
'if test $c -eq $COMP_CWORD -a -z "$command"; then', [
('# Complete name of subcommand if the user has not finished'
' typing it yet.'),
'if test $c -eq $COMP_CWORD -a -z "$command"; then', [
- ('COMPREPLY=($(compgen -W "$_stg_commands" --'
+ ('COMPREPLY=($(compgen -W "help version copyright $_stg_commands" --'
' "${COMP_WORDS[COMP_CWORD]}"))'),
'return'],
'fi',
'',
'# Complete arguments to subcommands.',
'case "$command" in', [
' "${COMP_WORDS[COMP_CWORD]}"))'),
'return'],
'fi',
'',
'# Complete arguments to subcommands.',
'case "$command" in', [
+ 'help) ', [
+ ('COMPREPLY=($(compgen -W "$_stg_commands" --'
+ ' "${COMP_WORDS[COMP_CWORD]}"))'),
+ 'return ;;'],
+ 'version) return ;;',
+ 'copyright) return ;;'], [
'%s) _stg_%s ;;' % (cmd, cmd)
for cmd in sorted(commands.iterkeys())],
'esac')
'%s) _stg_%s ;;' % (cmd, cmd)
for cmd in sorted(commands.iterkeys())],
'esac')