diff --git a/oarepo_ui/cli.py b/oarepo_ui/cli.py index 59f33dbc..eb219764 100644 --- a/oarepo_ui/cli.py +++ b/oarepo_ui/cli.py @@ -1,7 +1,8 @@ import json as json_lib +import os import sys from pathlib import Path -import os + import click from flask.cli import with_appcontext from oarepo_runtime.cli import oarepo @@ -13,20 +14,23 @@ def ui(): """UI commands""" + @ui.command("components") def components(): - component_data = [] - script_directory = os.path.dirname(os.path.abspath(__file__ or '')) - components_directory = os.path.join(script_directory, 'templates', 'components') + script_directory = os.path.dirname(os.path.abspath(__file__ or "")) + components_directory = os.path.join(script_directory, "templates", "components") file_names = os.listdir(components_directory) for file_name in file_names: - component_data.append({"key": file_name.lower(), "component": file_name.replace(".jinja", "")}) + component_data.append( + {"key": file_name.lower(), "component": file_name.replace(".jinja", "")} + ) print(component_data) + @ui.command("renderers") @click.option("-v", "--verbose", is_flag=True, help="Verbose output") @click.option("--json", is_flag=True, help="Format output as json") diff --git a/oarepo_ui/resources/templating.py b/oarepo_ui/resources/templating.py index 9d52e6ee..66346fe8 100644 --- a/oarepo_ui/resources/templating.py +++ b/oarepo_ui/resources/templating.py @@ -1,6 +1,6 @@ from jinja2 import Environment from jinja2.loaders import BaseLoader -import os + class RegistryLoader(BaseLoader): def __init__(self, parent_loader) -> None: @@ -55,4 +55,3 @@ def jinja_env(self): def id_filter(x): return id(x) -