def main(): op = optparse.OptionParser() op.add_option( '--stgit-version', action='store_true', help='Print StGit version', ) op.add_option( '--asciidoc', metavar='CMD', 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', ) op.add_option( '--fish-completion', action='store_true', help='Write fish completion code', ) options, args = op.parse_args() if args: op.error('Wrong number of arguments') if options.stgit_version: print(stgit.version.get_version()) elif options.asciidoc: argparse.write_asciidoc(stgit.main.commands[options.asciidoc], sys.stdout) elif options.commands: for cmd, _, _, _ in commands.get_commands(allow_cached=False): 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: write_bash_completion(sys.stdout) elif options.fish_completion: write_fish_completion(sys.stdout) else: op.error('No command')
) # generate the python command list with open('stgit/commands/cmdlist.py', 'w') as f: commands.py_commands(commands.get_commands(allow_cached=False), f) if not os.path.exists('completion'): os.mkdir('completion') # generate the bash completion script with open(os.path.join('completion', 'stgit.bash'), 'w') as f: write_bash_completion(f) # generate the fish completion script with open(os.path.join('completion', 'stg.fish'), 'w') as f: write_fish_completion(f) setup( name='stgit', version=ver, license='GPLv2', author='Catalin Marinas', author_email='*****@*****.**', url='http://www.procode.org/stgit/', download_url='https://repo.or.cz/stgit.git', description='Stacked GIT', long_description='Push/pop utility on top of GIT', scripts=['stg'], packages=list( map( str,