11import pathlib
22
3- import typer
3+ import cyclopts
44
5- app = typer . Typer ( no_args_is_help = True )
5+ app = cyclopts . App ( name = "components" )
66
7- generate_app = typer . Typer ( no_args_is_help = True )
8- app .add_typer (generate_app , name = "generate" , no_args_is_help = True )
7+ generate_app = cyclopts . App ( name = "generate" )
8+ app .command (generate_app )
99
10- component_references_app = typer .Typer (no_args_is_help = True )
11- app .add_typer (
12- component_references_app , name = "component-references" , no_args_is_help = True
13- )
10+ component_references_app = cyclopts .App (name = "component-references" )
11+ app .command (component_references_app )
1412
15- annotations_app = typer . Typer ( no_args_is_help = True )
16- app .add_typer (annotations_app , name = "annotations" , no_args_is_help = True )
13+ annotations_app = cyclopts . App ( name = "annotations" )
14+ app .command (annotations_app )
1715
1816# region components
1917
@@ -34,15 +32,15 @@ def components_set_container_image(component_path: str):
3432# region components/annotations
3533
3634
37- @annotations_app .command (name = "set" , no_args_is_help = True )
35+ @annotations_app .command (name = "set" )
3836def components_annotations_set (
3937 component_path : str , key : str , value : str , output_component_path : str | None = None
4038):
4139 """Sets annotation value in component file."""
4240 raise NotImplementedError ()
4341
4442
45- @annotations_app .command (name = "get" , no_args_is_help = True )
43+ @annotations_app .command (name = "get" )
4644def components_annotations_get (component_path : str , keys : list [str ]):
4745 """Sets annotation values from component file."""
4846 print (locals ())
@@ -54,8 +52,11 @@ def components_annotations_get(component_path: str, keys: list[str]):
5452
5553# region components/generate
5654
55+ _from_template_app = cyclopts .App (name = "from-template" , show = False )
56+ generate_app .command (_from_template_app )
5757
58- @generate_app .command (name = "from-template" , hidden = True )
58+
59+ @_from_template_app .default
5960def components_generate_from_template (
6061 template_name : str ,
6162 output_component_path : pathlib .Path ,
@@ -65,10 +66,8 @@ def components_generate_from_template(
6566
6667@generate_app .command (name = "from-python-function" )
6768def components_generate_from_python_function (output_component_path : str ):
68- """
69- Generates component from a Python function
70- """
69+ """Generates component from a Python function"""
7170 raise NotImplementedError ()
7271
7372
74- # endregion
73+ # endregion
0 commit comments