From 7d19db96c4c3cc9625ab8303d7d0777cb72fea90 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 2 Feb 2022 15:39:53 +0100 Subject: [PATCH] create cli commands for project backpack functions --- openpype/cli.py | 20 ++++++++++++++++++++ openpype/pype_commands.py | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/openpype/cli.py b/openpype/cli.py index 6e9c237b0e..f15306e3d3 100644 --- a/openpype/cli.py +++ b/openpype/cli.py @@ -412,3 +412,23 @@ def repack_version(directory): directory name. """ PypeCommands().repack_version(directory) + + +@main.command() +@click.option("--project", help="Project name") +@click.option( + "--dirpath", help="Directory where package is stored", default=None +) +def pack_project(project_name, dirpath): + """Create a package of project with all files and database dump.""" + PypeCommands().pack_project(project_name, dirpath) + + +@main.command() +@click.option("--zipfile", help="Path to zip file") +@click.option( + "--root", help="Replace root which was stored in project", default=None +) +def uppack_project(zipfile, root): + """Create a package of project with all files and database dump.""" + PypeCommands().unpack_project(zipfile, root) diff --git a/openpype/pype_commands.py b/openpype/pype_commands.py index de0336be2b..e5db036c04 100644 --- a/openpype/pype_commands.py +++ b/openpype/pype_commands.py @@ -433,3 +433,13 @@ class PypeCommands: version_packer = VersionRepacker(directory) version_packer.process() + + def pack_project(project_name, dirpath): + from openpype.lib.project_backpack import pack_project + + pack_project(project_name, dirpath) + + def unpack_project(zip_filepath, new_root): + from openpype.lib.project_backpack import unpack_project + + unpack_project(zip_filepath, new_root)