Skip to content
Open
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
8 changes: 5 additions & 3 deletions cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
#
import click

from cli.common.generate_item_yaml import generate_item_yaml
from cli.common.test_suite import test_suite
from cli.common.update_readme import update_readme
from cli.functions.function_to_item import function_to_item_cli
from cli.functions.item_to_function import item_to_function_cli
from cli.marketplace.build import build_marketplace_cli
from cli.common.test_suite import test_suite
from cli.common.update_readme import update_readme
from cli.common.generate_item_yaml import generate_item_yaml


@click.group()
def cli():
pass


cli.add_command(generate_item_yaml, name="generate-item-yaml")
cli.add_command(item_to_function_cli, name="item-to-function")
cli.add_command(function_to_item_cli, name="function-to-item")
Expand Down
19 changes: 12 additions & 7 deletions cli/common/generate_item_yaml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from pathlib import Path
from datetime import datetime, timezone
from pathlib import Path

import click
from jinja2 import Environment, FileSystemLoader

Expand All @@ -14,14 +15,18 @@
@click.command()
@click.argument("type", type=click.Choice(list(TEMPLATES.keys())))
@click.argument("name")
@click.option("--overwrite", is_flag=True, help="Replace existing file instead of raising an error.")
@click.option(
"--overwrite",
is_flag=True,
help="Replace existing file instead of raising an error.",
)
def generate_item_yaml(type: str, name: str, overwrite: bool = False):
"""
Generate an item.yaml file from a template.
Generate an item.yaml file from a template.

type: one of the supported types (currently only `function` or `module`)
name: the function/module name (also used as the directory name)
overwrite: whether to overwrite existing item.yaml file
type: one of the supported types (currently only `function` or `module`)
name: the function/module name (also used as the directory name)
overwrite: whether to overwrite existing item.yaml file
"""
# Construct the target path
path = Path(f"{type}s/src/{name}").resolve()
Expand Down Expand Up @@ -53,4 +58,4 @@ def generate_item_yaml(type: str, name: str, overwrite: bool = False):


if __name__ == "__main__":
generate_item_yaml()
generate_item_yaml()
Loading
Loading