@@ -97,27 +97,12 @@ def _inject_project_metadata(
97
97
raise TemplateExceptions ("ERROR : Having some errors with injecting metadata" )
98
98
99
99
100
- def _print_version (ctx : Context , value : click .Option , * args , ** kwargs ) -> None :
101
- # TODO : apply this at fastapi-cli group
102
- """
103
- print current version of fastapi-fastkit
104
-
105
- :param ctx: context of passing configurations (NOT specify it at CLI)
106
- :type ctx: <Object click.Context>
107
- """
108
- if value :
109
- version_info = f"fastapi-fastkit version { __version__ } "
110
- click .echo (print (version_info ))
111
- ctx .exit ()
112
-
113
-
114
100
# --------------------------------------------------------------------------
115
101
# Click operator methods
116
102
# --------------------------------------------------------------------------
117
103
@click .group ()
118
104
@click .option ("--debug/--no-debug" , default = False )
119
- # @click.option('--version', callback=_print_version,
120
- # expose_value=False)
105
+ @click .version_option (__version__ , prog_name = "fastapi-fastkit" )
121
106
@click .pass_context
122
107
def fastkit_cli (ctx : Context , debug : bool ) -> Union ["BaseCommand" , None ]:
123
108
"""
@@ -233,6 +218,10 @@ def startproject(
233
218
f"Error: Template '{ template } ' does not exist in '{ template_dir } '."
234
219
)
235
220
# TODO : add confirm step : checking template stack & name & metadata, confirm it y/n
221
+ click .echo (f"\n Project Name: { project_name } " )
222
+ click .echo (f"Author: { author } " )
223
+ click .echo (f"Author Email: { author_email } " )
224
+ click .echo (f"Description: { description } " )
236
225
# click.echo("Project Stack: [FastAPI, Uvicorn, SQLAlchemy, Docker (optional)]")
237
226
238
227
confirm = click .confirm (
@@ -244,23 +233,16 @@ def startproject(
244
233
245
234
try :
246
235
user_local = settings .USER_WORKSPACE
247
- click .echo (f"FastAPI template project will deploy at '{ user_local } '" )
248
-
249
- click .echo (f"Project Name: { project_name } " )
236
+ project_dir = os .path .join (user_local , project_name )
250
237
251
- confirm = click .confirm (
252
- "\n Do you want to proceed with project creation?" , default = False
253
- )
254
- if not confirm :
255
- click .echo ("Project creation aborted!" )
256
- return
238
+ click .echo (f"FastAPI template project will deploy at '{ user_local } '" )
257
239
258
- copy_and_convert_template (target_template , user_local )
240
+ copy_and_convert_template (target_template , project_dir , project_name )
259
241
260
- _new_user_local = os .path .join (user_local , template )
242
+ # _new_user_local = os.path.join(user_local, template)
261
243
262
244
_inject_project_metadata (
263
- _new_user_local , project_name , author , author_email , description
245
+ project_dir , project_name , author , author_email , description
264
246
)
265
247
266
248
click .echo (
0 commit comments