Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Merge cli and cli_commands #802

Merged
merged 5 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions client/ayon_core/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import code
import traceback
from pathlib import Path
import warnings

import click
import acre
Expand All @@ -18,7 +19,6 @@
Logger,
)

from .cli_commands import Commands


class AliasedGroup(click.Group):
Expand Down Expand Up @@ -116,14 +116,25 @@ def extractenvironments(
This function is deprecated and will be removed in future. Please use
'addon applications extractenvironments ...' instead.
"""
Commands.extractenvironments(
output_json_path,
project,
asset,
task,
app,
envgroup,
ctx.obj["addons_manager"]
warnings.warn(
(
"Command 'extractenvironments' is deprecated and will be"
" removed in future. Please use"
" 'addon applications extractenvironments ...' instead."
),
DeprecationWarning
)

addons_manager = ctx.obj["addons_manager"]
applications_addon = addons_manager.get_enabled_addon("applications")
if applications_addon is None:
raise RuntimeError(
"Applications addon is not available or enabled."
)

# Please ignore the fact this is using private method
applications_addon._cli_extract_environments(
output_json_path, project, asset, task, app, envgroup
)


Expand All @@ -132,15 +143,15 @@ def extractenvironments(
@click.argument("path", required=True)
@click.option("-t", "--targets", help="Targets", default=None,
multiple=True)
@click.option("-g", "--gui", is_flag=True,
help="Show Publish UI", default=False)
def publish(ctx, path, targets, gui):
def publish(ctx, path, targets):
"""Start CLI publishing.

Publish collects json from path provided as an argument.

"""
Commands.publish(path, targets, gui, ctx.obj["addons_manager"])
from ayon_core.pipeline.publish import main_cli_publish

main_cli_publish(path, targets, ctx.obj["addons_manager"])


@main_cli.command(context_settings={"ignore_unknown_options": True})
Expand Down Expand Up @@ -170,12 +181,10 @@ def contextselection(
Context is project name, folder path and task name. The result is stored
into json file which path is passed in first argument.
"""
Commands.contextselection(
output_path,
project,
folder,
strict
)
from ayon_core.tools.context_dialog import main

main(output_path, project, folder, strict)



@main_cli.command(
Expand Down
171 changes: 0 additions & 171 deletions client/ayon_core/cli_commands.py

This file was deleted.

4 changes: 4 additions & 0 deletions client/ayon_core/pipeline/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
get_plugin_settings,
get_publish_instance_label,
get_publish_instance_families,

main_cli_publish,
)

from .abstract_expected_files import ExpectedFiles
Expand Down Expand Up @@ -92,6 +94,8 @@
"get_publish_instance_label",
"get_publish_instance_families",

"main_cli_publish",

"ExpectedFiles",

"RenderInstance",
Expand Down
Loading