def generate(namespace): """Run `neurodocker generate`.""" specs = utils._namespace_to_specs(namespace) df = Dockerfile(specs) if not namespace.no_print_df: print(df.cmd) if namespace.output: df.save(filepath=namespace.output)
def generate(namespace): """Run `neurodocker generate`.""" if namespace.file is None: specs = utils._namespace_to_specs(namespace) else: specs = utils.load_json(namespace.file) recipe_objs = {"docker": Dockerfile, "singularity": SingularityRecipe} recipe_obj = recipe_objs[namespace.subsubparser_name](specs) if namespace.json: print(json.dumps(specs)) elif not namespace.no_print: print(recipe_obj.render()) if namespace.output: recipe_obj.save(filepath=namespace.output)