Skip to content

Commit 888b18b

Browse files
committed
default yes to prompts
1 parent 84fd212 commit 888b18b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

setup.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,15 @@ def detect_timezone() -> str:
8585
return "UTC"
8686

8787

88-
def confirm(question: str) -> bool:
88+
def confirm(question: str, default_yes: bool = False) -> bool:
89+
hint = "[Y/n]" if default_yes else "[y/N]"
8990
try:
90-
response = input(f"{question} [y/N]: ").strip().lower()
91+
response = input(f"{question} {hint}: ").strip().lower()
9192
except (EOFError, KeyboardInterrupt):
9293
print()
9394
return False
95+
if not response:
96+
return default_yes
9497
return response in ("y", "yes")
9598

9699

@@ -210,7 +213,7 @@ def ensure_tls_certs() -> None:
210213
print("Please place cert.pem and key.pem in ./certs/ manually.")
211214
return
212215

213-
if not confirm("Generate a self-signed certificate for localhost?"):
216+
if not confirm("Generate a self-signed certificate for localhost?", default_yes=True):
214217
print("Skipped. Place cert.pem and key.pem in ./certs/ before starting.")
215218
return
216219

@@ -295,7 +298,7 @@ def main() -> None:
295298
ensure_tls_certs()
296299

297300
print()
298-
if confirm("Start the Docker Compose stack now?"):
301+
if confirm("Start the Docker Compose stack now?", default_yes=True):
299302
start_stack()
300303
else:
301304
print("\nTo start later, run:")

0 commit comments

Comments
 (0)