Skip to content

Commit f3c7c9f

Browse files
committed
[FEAT] change cli: startproject -> startup, add checking template cli & create new fastapi project cli(not start with using template)
1 parent 7227266 commit f3c7c9f

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/fastapi_fastkit/cli.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ def echo(ctx: Context) -> None:
165165
click.echo(debug_output)
166166

167167

168+
@fastkit_cli.command()
169+
def list() -> None:
170+
# TODO : impl this
171+
"""
172+
Get available templates list.
173+
:return: None
174+
"""
175+
pass
176+
177+
168178
@fastkit_cli.command(context_settings={"ignore_unknown_options": True})
169179
@click.argument("template", default="fastapi-default")
170180
@click.option(
@@ -188,7 +198,7 @@ def echo(ctx: Context) -> None:
188198
help="The description of the new FastAPI project.",
189199
)
190200
@click.pass_context
191-
def startproject(
201+
def startup(
192202
ctx: Context,
193203
template: str,
194204
project_name: str,
@@ -205,6 +215,7 @@ def startproject(
205215
:param author: Author name
206216
:param author_email: Author email
207217
:param description: Project description
218+
:return: None
208219
"""
209220
settings = ctx.obj["settings"]
210221

@@ -249,10 +260,21 @@ def startproject(
249260
click.echo(f"Error during project creation: {e}")
250261

251262

263+
@fastkit_cli.command(context_settings={"ignore_unknown_options": True})
264+
def startproject() -> None:
265+
# TODO : impl this, add a stack selecting process?
266+
"""
267+
Start a empty FastAPI project.
268+
:return:
269+
"""
270+
pass
271+
272+
252273
@fastkit_cli.command()
253274
@click.argument("project_name")
254275
@click.pass_context
255276
def deleteproject(ctx: Context, project_name: str) -> None:
277+
# TODO : add checking step - if target project is not from fastkit, discard the attempt.
256278
settings = ctx.obj["settings"]
257279

258280
user_local = settings.USER_WORKSPACE

tests/test_cli_operations/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ def test_echo(self) -> None:
4444
in result.output
4545
)
4646

47-
def test_startproject(self, temp_dir) -> None:
47+
def test_startup(self, temp_dir) -> None:
4848
# given
4949
os.chdir(temp_dir)
5050

5151
# when
5252
result = self.runner.invoke(
5353
fastkit_cli, # type: ignore
54-
["startproject", "fastapi-default"],
54+
["startup", "fastapi-default"],
5555
input="\n".join(
5656
["test-project", "bnbong", "bbbong9@gmail.com", "test project", "Y"]
5757
),
@@ -92,7 +92,7 @@ def test_deleteproject(self, temp_dir) -> None:
9292
project_name = "test-project"
9393
result = self.runner.invoke(
9494
fastkit_cli, # type: ignore
95-
["startproject", "fastapi-default"],
95+
["startup", "fastapi-default"],
9696
input="\n".join(
9797
[project_name, "bnbong", "bbbong9@gmail.com", "test project", "Y"]
9898
),

0 commit comments

Comments
 (0)