def main():
    # type: () -> typing.Any
    """Parse the command line options and launch the requested command.

    If the command is 'help' then print the help message for the subcommand; if
    no subcommand is given, print the standard help message.
    """
    colorama.init(wrap=six.PY3)
    doc = usage.get_primary_command_usage()
    allow_subcommands = '<command>' in doc
    args = docopt(doc, version=settings.version,
                  options_first=allow_subcommands)
    if sys.excepthook is sys.__excepthook__:
        sys.excepthook = log.excepthook
    try:
        log.enable_logging(log.get_log_level(args))
        default_args = sys.argv[2 if args.get('<command>') else 1:]
        if (args.get('<command>') == 'help' and
                None not in settings.subcommands):
            subcommand = next(iter(args.get('<args>', default_args)), None)
            return usage.get_help_usage(subcommand)
        argv = [args.get('<command>')] + args.get('<args>', default_args)
        return _run_command(argv)
    except exc.InvalidCliValueError as e:
        return str(e)
Parse the command line options and launch the requested command.

    If the command is 'help' then print the help message for the subcommand; if
    no subcommand is given, print the standard help message.