Skip to content
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
29 changes: 7 additions & 22 deletions plugins/tutor-contrib-paragon/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,36 +102,21 @@ Invoke the build process via Tutor:

tutor local do paragon-build-tokens [OPTIONS]

Available options:

- ``--source-tokens-only``
Include only source design tokens in the build.

- ``--output-token-references``
Include references for tokens with aliases to other tokens in the build output.

- ``--themes <theme1,theme2>``
Comma-separated list of theme names to compile. Defaults to the list defined in ``PARAGON_ENABLED_THEMES`` if not provided.

- ``-v, --verbose``
Enable verbose logging.
For more information about available options, refer to the `Paragon CLI documentation <https://github.com/openedx/paragon/?tab=readme-ov-file#paragon-cli>`__.

Examples
--------

.. code-block:: bash

# Compile all themes listed in PARAGON_ENABLED_THEMES
tutor local do paragon-build-tokens

# Compile only specific themes
tutor local do paragon-build-tokens --themes theme-1,theme-2
# Compile all themes listed in PARAGON_ENABLED_THEMES
tutor local do paragon-build-tokens

# Compile with full debug logs
tutor local do paragon-build-tokens --verbose
# Compile only specific themes
tutor local do paragon-build-tokens --themes theme-1,theme-2

# Compile only source tokens for a single theme
tutor local do paragon-build-tokens --themes theme-1 --source-tokens-only
# Pass any other Paragon CLI options as needed
tutor local do paragon-build-tokens --paragon-option value

Output
------
Expand Down
49 changes: 6 additions & 43 deletions plugins/tutor-contrib-paragon/tutorparagon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,13 @@
import click


@click.command()
@click.option(
"--source-tokens-only",
is_flag=True,
default=False,
help="Include only source design tokens in the build.",
@click.command(
context_settings=dict(ignore_unknown_options=True, allow_extra_args=True)
)
@click.option(
"--output-token-references",
is_flag=True,
default=False,
help="Include references for tokens with aliases to other tokens in the build output.",
)
@click.option("--themes", help="Comma-separated list of themes to build.")
@click.option(
"-v", "--verbose", is_flag=True, default=False, help="Enable verbose logging."
)
def paragon_build_tokens(
source_tokens_only: bool,
output_token_references: bool,
themes: str,
verbose: bool,
) -> list[tuple[str, str]]:
@click.pass_context
def paragon_build_tokens(ctx: click.Context) -> list[tuple[str, str]]:
"""
Build theme token files using Paragon.

Args:
source_tokens_only (bool): Only source design tokens.
output_token_references (bool): Output token references.
themes (str): Comma-separated list of themes.
verbose (bool): Verbose logging.

Returns:
list[tuple[str, str]]: List of commands to run.
Accepts and forwards all options/arguments to paragon-builder.
"""
args = []
if source_tokens_only:
args.append("--source-tokens-only")
if output_token_references:
args.append("--output-token-references")
if themes:
args.append("--themes")
args.append(themes)
if verbose:
args.append("--verbose")

return [("paragon-builder", " ".join(args))]
return [("paragon-builder", " ".join(ctx.args))]