ezmomi icon indicating copy to clipboard operation
ezmomi copied to clipboard

have get_configs respect required/optional args

Open snobear opened this issue 10 years ago • 0 comments

The get_configs function in ezmomi.py merges the config.yml settings with settings supplied on the command line (argparse).

Currently, ezmomi complains if any parameter has not been set on the command line or in the config file, even if its been marked as required=False in params.py. We want it to ignore any optional arguments.

Here's the relevant bits:

        # Check all required values were supplied either via command line
        # or config. override defaults from config.yml with any supplied
        # command line arguments
        notset = list()
        for key, value in kwargs.items():
            if value:
                config[key] = value
            elif (value is None) and (key not in config):
                # compile list of parameters that were not set
                notset.append(key)

        if notset:
            print "Required parameters not set: %s\n" % notset
            sys.exit(1)

snobear avatar Aug 19 '14 15:08 snobear