Make "stg log" show stack log instead of patch log
[stgit] / stg-build
CommitLineData
575bbdae
KH
1#!/usr/bin/env python
2# -*- python -*-
3import optparse, sys
4import stgit.main
33ff9cdd 5from stgit import argparse, commands
575bbdae
KH
6
7def main():
8 op = optparse.OptionParser()
9 op.add_option('--asciidoc', metavar = 'CMD',
10 help = 'Print asciidoc documentation for a command')
11 op.add_option('--commands', action = 'store_true',
12 help = 'Print list of all stg subcommands')
33ff9cdd
KH
13 op.add_option('--cmd-list', action = 'store_true',
14 help = 'Print asciidoc command list')
15 op.add_option('--py-cmd-list', action = 'store_true',
16 help = 'Write Python command list')
575bbdae
KH
17 options, args = op.parse_args()
18 if args:
19 op.error('Wrong number of arguments')
20 if options.asciidoc:
21 argparse.write_asciidoc(stgit.main.commands[options.asciidoc],
22 sys.stdout)
23 elif options.commands:
33ff9cdd
KH
24 for cmd in sorted(commands.get_commands(
25 allow_cached = False).iterkeys()):
575bbdae 26 print cmd
33ff9cdd
KH
27 elif options.cmd_list:
28 commands.asciidoc_command_list(
29 commands.get_commands(allow_cached = False), sys.stdout)
30 elif options.py_cmd_list:
31 commands.py_commands(commands.get_commands(allow_cached = False),
32 sys.stdout)
575bbdae
KH
33 else:
34 op.error('No command')
35
36if __name__ == '__main__':
37 main()