def cli()

in mozregression/cli.py [0:0]


def cli(argv=None, conf_file=DEFAULT_CONF_FNAME, namespace=None):
    """
    parse cli args basically and returns a :class:`Configuration`.

    if namespace is given, it will be used as a arg parsing result, so no
    arg parsing will be done.
    """
    config = get_config(conf_file)
    if namespace:
        options = namespace
    else:
        options = parse_args(argv=argv, defaults=config)
        if not options.cmdargs:
            # we don't set the cmdargs default to be that from the
            # configuration file, because then any new arguments
            # will be appended: https://bugs.python.org/issue16399
            options.cmdargs = config["cmdargs"]
    if conf_file and not os.path.isfile(conf_file):
        print("*" * 10)
        print(
            colorize(
                "You should use a config file. Please use the "
                + "{sBRIGHT}--write-config{sRESET_ALL}"
                + " command line flag to help you create one."
            )
        )
        print("*" * 10)
        print()
    return Configuration(options, config)