8 from stgit
import argparse
, commands
9 from stgit
.completion
.bash
import write_bash_completion
10 from stgit
.completion
.fish
import write_fish_completion
14 op
= optparse
.OptionParser()
18 help='Print StGit version',
23 help='Print asciidoc documentation for a command',
28 help='Print list of all stg subcommands',
33 help='Print asciidoc command list',
38 help='Write Python command list',
43 help='Write bash completion code',
48 help='Write fish completion code',
50 options
, args
= op
.parse_args()
52 op
.error('Wrong number of arguments')
53 if options
.stgit_version
:
54 print(stgit
.version
.get_version())
55 elif options
.asciidoc
:
56 argparse
.write_asciidoc(stgit
.main
.commands
[options
.asciidoc
], sys
.stdout
)
57 elif options
.commands
:
58 for cmd
, _
, _
, _
in commands
.get_commands(allow_cached
=False):
60 elif options
.cmd_list
:
61 commands
.asciidoc_command_list(
62 commands
.get_commands(allow_cached
=False), sys
.stdout
64 elif options
.py_cmd_list
:
65 commands
.py_commands(commands
.get_commands(allow_cached
=False), sys
.stdout
)
66 elif options
.bash_completion
:
67 write_bash_completion(sys
.stdout
)
68 elif options
.fish_completion
:
69 write_fish_completion(sys
.stdout
)
71 op
.error('No command')
74 if __name__
== '__main__':
75 if os
.environ
.get('COVERAGE_PROCESS_START'):
78 cov
= coverage
.process_startup()
79 cov
.switch_context('build')