Skip to content

Commit fc1c2d0

Browse files
authored
Added requirements check before startup (#155)
1 parent e27fd94 commit fc1c2d0

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

fastapi_template/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
from pathlib import Path
32

43
from cookiecutter.exceptions import FailedHookException, OutputDirExistsException

fastapi_template/cli.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import shutil
12
from fastapi_template.input_model import (
23
BuilderContext,
34
MenuEntry,
@@ -585,4 +586,18 @@ def run_command(callback: Callable[[BuilderContext], None]) -> None:
585586
)
586587
for menu in menus:
587588
cmd.params.extend(menu.get_cli_options())
589+
required_commands = {
590+
"poetry": "https://python-poetry.org/docs/#installation",
591+
"git": "https://git-scm.com/",
592+
}
593+
for prog, link in required_commands.items():
594+
if shutil.which(prog) is None:
595+
print(
596+
"Please install {prog} before generating project. Link: {link}".format(
597+
prog=colored(prog, "green"),
598+
link=colored(link, "cyan"),
599+
),
600+
)
601+
return
602+
588603
cmd.main()

0 commit comments

Comments
 (0)