mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Allow calling ifcpatch from code with no arguments
This commit is contained in:
@@ -76,10 +76,11 @@ def execute(args: dict) -> Union[ifcopenshell.file, str]:
|
|||||||
logger = logging.getLogger("IFCPatch")
|
logger = logging.getLogger("IFCPatch")
|
||||||
recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes")
|
recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes")
|
||||||
recipe = getattr(recipes, args["recipe"])
|
recipe = getattr(recipes, args["recipe"])
|
||||||
|
arguments = args.get("arguments", [])
|
||||||
if recipe.Patcher.__init__.__doc__ is not None:
|
if recipe.Patcher.__init__.__doc__ is not None:
|
||||||
patcher = recipe.Patcher(args.get("input"), args["file"], logger, *args["arguments"])
|
patcher = recipe.Patcher(args.get("input"), args["file"], logger, *arguments)
|
||||||
else:
|
else:
|
||||||
patcher = recipe.Patcher(args.get("input"), args["file"], logger, args["arguments"])
|
patcher = recipe.Patcher(args.get("input"), args["file"], logger, arguments)
|
||||||
patcher.patch()
|
patcher.patch()
|
||||||
output = getattr(patcher, "file_patched", patcher.file)
|
output = getattr(patcher, "file_patched", patcher.file)
|
||||||
return output
|
return output
|
||||||
|
|||||||
Reference in New Issue
Block a user