def toxcmd_main(args=None):
 usage = 'USAGE: %(prog)s [OPTIONS] COMMAND args...'
 if (args is None):
  args = sys.argv[1:]
 parser = argparse.ArgumentParser(description=inspect.getdoc(toxcmd_main), formatter_class=FORMATTER_CLASS)
 common_parser = parser.add_argument_group('Common options')
 common_parser.add_argument('--version', action='version', version=VERSION)
 subparsers = parser.add_subparsers(help='commands')
 for command in discover_commands():
  command_parser = subparsers.add_parser(command.name, usage=command.usage, description=command.description, help=command.short_description, formatter_class=FORMATTER_CLASS)
  command_parser.set_defaults(func=command)
  command.setup_parser(command_parser)
  command.parser = command_parser
 options = parser.parse_args(args)
 command_function = options.func
 return command_function(options)

def toxcmd_main ( args = None ) : usage = 'USAGE: %(prog)s [OPTIONS] COMMAND args...' if ( args is None ) : args = sys . argv [ 1 : ] parser = argparse . ArgumentParser ( description = inspect . getdoc ( toxcmd_main ) , formatter_class = FORMATTER_CLASS ) common_parser = parser . add_argument_group ( 'Common options' ) common_parser . add_argument ( '--version' , action = 'version' , version = VERSION ) subparsers = parser . add_subparsers ( help = 'commands' ) for command in discover_commands ( ) : command_parser = subparsers . add_parser ( command . name , usage = command . usage , description = command . description , help = command . short_description , formatter_class = FORMATTER_CLASS ) command_parser . set_defaults ( func = command ) command . setup_parser ( command_parser ) command . parser = command_parser options = parser . parse_args ( args ) command_function = options . func return command_function ( options )
command util with subcommands for tox environments .