diff --git a/openpype/cli.py b/openpype/cli.py index c69407e295..b79055d474 100644 --- a/openpype/cli.py +++ b/openpype/cli.py @@ -57,7 +57,13 @@ def tray(debug=False): PypeCommands().launch_tray(debug) -@main.command() +@PypeCommands.add_modules +@main.group(help="Run command line arguments of OpenPype modules") +@click.pass_context +def module(ctx): + pass + + @click.option("-d", "--debug", is_flag=True, help="Print debug messages") @click.option("--ftrack-url", envvar="FTRACK_SERVER", help="Ftrack server url") diff --git a/openpype/pype_commands.py b/openpype/pype_commands.py index 5288749e8b..d6895bcb2c 100644 --- a/openpype/pype_commands.py +++ b/openpype/pype_commands.py @@ -3,6 +3,7 @@ import os import sys import json +import click from datetime import datetime from openpype.lib import PypeLogger @@ -33,6 +34,16 @@ class PypeCommands: user_role = "manager" settings.main(user_role) + @staticmethod + def add_modules(click_func): + from openpype.modules import ModulesManager + + manager = ModulesManager() + for module in manager.modules: + if hasattr(module, "cli"): + module.cli(click_func) + return click_func + @staticmethod def launch_eventservercli(*args): from openpype_modules.ftrack.ftrack_server.event_server_cli import (