X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/575bbdaeb6b8fae0eef19672d288361282b83fb4..3dccdc9bf6d5b2e72a982187f5f947b20f24fc87:/stg-build diff --git a/stg-build b/stg-build index 8c39a6f..2af6523 100755 --- a/stg-build +++ b/stg-build @@ -2,7 +2,7 @@ # -*- python -*- import optparse, sys import stgit.main -from stgit import argparse +from stgit import argparse, commands, completion def main(): op = optparse.OptionParser() @@ -10,6 +10,12 @@ def main(): help = 'Print asciidoc documentation for a command') op.add_option('--commands', action = 'store_true', help = 'Print list of all stg subcommands') + op.add_option('--cmd-list', action = 'store_true', + help = 'Print asciidoc command list') + op.add_option('--py-cmd-list', action = 'store_true', + help = 'Write Python command list') + op.add_option('--bash-completion', action = 'store_true', + help = 'Write bash completion code') options, args = op.parse_args() if args: op.error('Wrong number of arguments') @@ -17,8 +23,17 @@ def main(): argparse.write_asciidoc(stgit.main.commands[options.asciidoc], sys.stdout) elif options.commands: - for cmd in sorted(stgit.main.commands.iterkeys()): + for cmd in sorted(commands.get_commands( + allow_cached = False).iterkeys()): print cmd + elif options.cmd_list: + commands.asciidoc_command_list( + commands.get_commands(allow_cached = False), sys.stdout) + elif options.py_cmd_list: + commands.py_commands(commands.get_commands(allow_cached = False), + sys.stdout) + elif options.bash_completion: + completion.write_completion(sys.stdout) else: op.error('No command')