mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
implemented 'add_modules' which will call cli method on module to give ability to register custom cli commands
This commit is contained in:
parent
f8e594be80
commit
dee8156a0c
2 changed files with 12 additions and 0 deletions
|
|
@ -57,6 +57,7 @@ def tray(debug=False):
|
|||
PypeCommands().launch_tray(debug)
|
||||
|
||||
|
||||
@PypeCommands.add_modules
|
||||
@main.group(help="Run command line arguments of OpenPype modules")
|
||||
@click.pass_context
|
||||
def module(ctx):
|
||||
|
|
|
|||
|
|
@ -41,6 +41,17 @@ class PypeCommands:
|
|||
user_role = "manager"
|
||||
settings.main(user_role)
|
||||
|
||||
@staticmethod
|
||||
def add_modules(click_func):
|
||||
"""Modules/Addons can add their cli commands dynamically."""
|
||||
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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue