5 from stgit
import argparse
, commands
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')
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')
17 options
, args
= op
.parse_args()
19 op
.error('Wrong number of arguments')
21 argparse
.write_asciidoc(stgit
.main
.commands
[options
.asciidoc
],
23 elif options
.commands
:
24 for cmd
in sorted(commands
.get_commands(
25 allow_cached
= False).iterkeys()):
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),
34 op
.error('No command')
36 if __name__
== '__main__':