From f51325543a1965f63e5dd70980227311b735c962 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 9 Dec 2022 11:32:54 +0100 Subject: [PATCH 1/3] change default command for headless mode --- openpype/cli.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openpype/cli.py b/openpype/cli.py index d24cd4a872..7611915d84 100644 --- a/openpype/cli.py +++ b/openpype/cli.py @@ -29,8 +29,14 @@ def main(ctx): It wraps different commands together. """ + if ctx.invoked_subcommand is None: - ctx.invoke(tray) + # Default command for headless openpype is 'interactive' command + # otherwise 'tray' is used. + if os.environ.get("OPENPYPE_HEADLESS_MODE") == "1": + ctx.invoke(interactive) + else: + ctx.invoke(tray) @main.command() From 76f1cbc2e3b93df36cc7bdc140e86ec5d0051f14 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 12 Dec 2022 18:31:19 +0100 Subject: [PATCH 2/3] print help instead of invokinf 'interactive' command --- openpype/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/cli.py b/openpype/cli.py index 7611915d84..2c32220522 100644 --- a/openpype/cli.py +++ b/openpype/cli.py @@ -34,7 +34,8 @@ def main(ctx): # Default command for headless openpype is 'interactive' command # otherwise 'tray' is used. if os.environ.get("OPENPYPE_HEADLESS_MODE") == "1": - ctx.invoke(interactive) + print(ctx.get_help()) + sys.exit(0) else: ctx.invoke(tray) From b05bcf94258c52578f9758205e3fb74d220e645b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 12 Dec 2022 18:34:07 +0100 Subject: [PATCH 3/3] Change comment --- openpype/cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpype/cli.py b/openpype/cli.py index 2c32220522..897106c35f 100644 --- a/openpype/cli.py +++ b/openpype/cli.py @@ -31,8 +31,7 @@ def main(ctx): """ if ctx.invoked_subcommand is None: - # Default command for headless openpype is 'interactive' command - # otherwise 'tray' is used. + # Print help if headless mode is used if os.environ.get("OPENPYPE_HEADLESS_MODE") == "1": print(ctx.get_help()) sys.exit(0)