Commit 91826f62 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch '53-some-command-line-default-options-are-not-working' into 'master'

Fixed issue #53 . The default resource is not working

Closes #53

See merge request !53
parents 356e71a6 97691ddb
Pipeline #5151 passed with stages
in 13 minutes and 12 seconds
......@@ -166,6 +166,10 @@ def _take_from_config_or_command_line(args, config, keyword, default, required=T
val = utils.load_resource(val, keyword, imports = args.imports, preferred_package = args.preferred_package)
setattr(args, keyword, val)
elif default is not None:
if is_resource:
setattr(args, keyword, utils.load_resource(' '.join(default), keyword, imports = args.imports, preferred_package = args.preferred_package))
elif required:
raise ValueError("Please specify a %s either on command line (via --%s) or in a configuration file" %(keyword, keyword))
......@@ -222,10 +226,10 @@ def initialize(parsers, command_line_parameters = None, skips = []):
_take_from_config_or_command_line(args, config, "grid",
parser.get_default(keyword), required=False)
parser.get_default('grid'), required=False)
_take_from_config_or_command_line(args, config, "sub_directory",
parser.get_default(keyword), is_resource=False)
parser.get_default("sub_directory"), is_resource=False)
skip_keywords = tuple(['skip_' + k.replace('-', '_') for k in skips])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment