Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzpeta authored and mesemus committed Dec 16, 2023
1 parent 6f25d04 commit 5d32974
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 9 additions & 5 deletions oarepo_ui/cli.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
Expand Down
3 changes: 1 addition & 2 deletions oarepo_ui/resources/templating.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from jinja2 import Environment
from jinja2.loaders import BaseLoader
import os


class RegistryLoader(BaseLoader):
def __init__(self, parent_loader) -> None:
Expand Down Expand Up @@ -55,4 +55,3 @@ def jinja_env(self):

def id_filter(x):
return id(x)

0 comments on commit 5d32974

Please sign in to comment.