|
14 | 14 | from rich.prompt import Prompt, Confirm |
15 | 15 | from rich.table import Table |
16 | 16 |
|
| 17 | +from ufazien import __version__ |
17 | 18 | from ufazien.client import UfazienAPIClient |
18 | 19 | from ufazien.utils import ( |
19 | 20 | create_zip, |
|
33 | 34 | create_build_project_structure, |
34 | 35 | ) |
35 | 36 |
|
| 37 | +console = Console() |
| 38 | + |
36 | 39 | app = typer.Typer( |
37 | 40 | name="ufazien", |
38 | 41 | help="🚀 Ufazien CLI - Deploy web applications on Ufazien platform", |
39 | 42 | add_completion=False, |
40 | 43 | ) |
41 | | -console = Console() |
| 44 | + |
| 45 | +def version_callback(value: bool) -> None: |
| 46 | + """Show version and exit.""" |
| 47 | + if value: |
| 48 | + console.print(f"ufazien CLI version {__version__}") |
| 49 | + raise typer.Exit() |
| 50 | + |
| 51 | +@app.callback(invoke_without_command=True) |
| 52 | +def main( |
| 53 | + ctx: typer.Context, |
| 54 | + version: bool = typer.Option(None, "--version", "-V", callback=version_callback, is_eager=True, help="Show version and exit"), |
| 55 | +) -> None: |
| 56 | + """🚀 Ufazien CLI - Deploy web applications on Ufazien platform.""" |
| 57 | + if ctx.invoked_subcommand is None: |
| 58 | + console.print(app.info.help) |
| 59 | + raise typer.Exit() |
42 | 60 |
|
43 | 61 |
|
44 | 62 | def require_auth(client: UfazienAPIClient) -> None: |
@@ -95,7 +113,7 @@ def logout() -> None: |
95 | 113 | def create( |
96 | 114 | name: Optional[str] = typer.Option(None, "--name", "-n", help="Website name"), |
97 | 115 | subdomain: Optional[str] = typer.Option(None, "--subdomain", "-s", help="Subdomain"), |
98 | | - website_type: Optional[str] = typer.Option(None, "--type", "-t", help="Website type (static or php)"), |
| 116 | + website_type: Optional[str] = typer.Option(None, "--type", "-t", help="Website type (static, php, or build)"), |
99 | 117 | database: bool = typer.Option(False, "--database", "-d", help="Create database (PHP only)"), |
100 | 118 | ) -> None: |
101 | 119 | """Create a new website project.""" |
|
0 commit comments