Skip to content

Commit

Permalink
components name cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzpeta committed Nov 1, 2023
1 parent ffdc6d9 commit 1407767
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
15 changes: 14 additions & 1 deletion oarepo_ui/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json as json_lib
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,6 +13,19 @@
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')

file_names = os.listdir(components_directory)

for file_name in file_names:
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")
Expand Down
17 changes: 0 additions & 17 deletions oarepo_ui/resources/templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,3 @@ def jinja_env(self):
def id_filter(x):
return id(x)


def get_components():

component_data = []
directory = os.path.dirname(os.path.abspath(__file__ or ''))
parent_directory = os.path.dirname(directory)
components_directory = os.path.join(parent_directory, 'templates', 'components')


file_names = os.listdir(components_directory)

for file_name in file_names:
component_data.append({"key": file_name.replace(".jinja", "").lower(), "component": file_name.replace(".jinja", "")})


return component_data

0 comments on commit 1407767

Please sign in to comment.