Commit 61a79065 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

better handle of file config

parent f16d98f4
......@@ -104,7 +104,7 @@ if __name__ == '__main__':
wfmanager = WorkflowsManager()
# Create the top-level parser
parser = JflowArgumentParser(fromfile_prefix_chars='@')
parser = JflowArgumentParser()
subparsers = parser.add_subparsers(title='Available sub commands')
# Add rerun workflow availability
......@@ -125,19 +125,15 @@ if __name__ == '__main__':
wf_instances = wfmanager.get_available_workflows()
wf_classes = []
for instance in wf_instances:
parser.convert_arg_line_to_args = instance.__class__.config_parser
wf_classes.append(instance.__class__.__name__)
# create the subparser for each applications
sub_parser = subparsers.add_parser(instance.name, help=instance.description)
sub_parser = subparsers.add_parser(instance.name, help=instance.description, fromfile_prefix_chars='@')
sub_parser.convert_arg_line_to_args = instance.__class__.config_parser
for param in instance.parameters:
sub_parser.add_argument(param.flag, **param.export_to_argparse())
sub_parser.set_defaults(cmd_object=instance.__class__.__name__, cmd_class=instance.__class__)
sub_parser.set_defaults(cmd_object=instance.__class__.__name__)
args = vars(parser.parse_args())
if args.has_key("cmd_class"):
# re parse args with the right parser
parser.convert_arg_line_to_args = args["cmd_class"].config_parser
args = vars(parser.parse_args())
if args["cmd_object"] in wf_classes:
wfmanager.run_workflow(args["cmd_object"], args)
......
Markdown is supported
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