From 26a77dcf84bfd5b0678b1d6fdac3bcd281bf116b Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 10 Feb 2026 16:39:45 +0000 Subject: [PATCH] Cleaner messages while running the setup. --- fastapi_vue_setup.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/fastapi_vue_setup.py b/fastapi_vue_setup.py index 419615b..cc393f4 100644 --- a/fastapi_vue_setup.py +++ b/fastapi_vue_setup.py @@ -33,6 +33,14 @@ _python_files_to_format: list[Path] = [] TEMPLATE_DIR = Path(__file__).parent / "template" +def print_boxed(text: str) -> None: + """Print text in a Unicode rounded box.""" + width = len(text) + 2 + print(f"╭{'─' * width}╮") + print(f"│ {text} │") + print(f"╰{'─' * width}╯") + + def ruff_sort_imports(files: list[Path], dry: bool = False) -> None: """Run ruff to sort imports in the given Python files.""" if not files: @@ -850,9 +858,7 @@ _OLD_VITE_PLUGIN_SHA256 = ( ) -def _upgrade_old_vite_plugin( - path: Path, module_name: str, dry: bool = False -) -> None: +def _upgrade_old_vite_plugin(path: Path, module_name: str, dry: bool = False) -> None: """Remove old vite-plugin-fastapi.js that lacks auto-upgrade marker. Old versions didn't have the upgrade marker, so write_file skips them as @@ -1180,6 +1186,8 @@ def cmd_setup(args: argparse.Namespace) -> int: project_dir = project_dir.resolve() dry = args.dry + print_boxed(f"fastapi-vue-setup {version}") + # Create project directory if it doesn't exist if not project_dir.exists(): if dry: @@ -1443,9 +1451,7 @@ def cmd_setup(args: argparse.Namespace) -> int: uv_add_packages(["httpx"], cwd=project_dir, group="dev") print() - print("=" * 60) - print("✅ Setup complete!") - print("=" * 60) + print_boxed("Setup complete!") # Show cd command only if project is not in current directory cd_cmd = "" if project_dir == Path.cwd() else f"cd {project_dir}\n " @@ -1472,11 +1478,6 @@ def cmd_setup(args: argparse.Namespace) -> int: return 0 -# ============================================================================= -# Main entry point -# ============================================================================= - - def is_uninitialized_folder(path: Path) -> bool: """Check if a folder appears to be completely uninitialized.""" return (