Skip to content

Commit a088ed9

Browse files
authored
Merge pull request #3 from martian56/fix-outdated-messages
[FIX] Fix outdated help messages, and more
2 parents ac1c057 + c5afdea commit a088ed9

File tree

8 files changed

+35
-12
lines changed

8 files changed

+35
-12
lines changed

.github/workflows/test_python_pkg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: |
3232
python -m pip install build
3333
python -m build
34-
pip install dist/*.whl
34+
pip install dist/*.whl || pip install .
3535
3636
- name: Verify CLI command
3737
run: |

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ ufazienjs create
8181

8282
The CLI will guide you through:
8383
- Website name and subdomain
84-
- Website type (Static or PHP)
84+
- Website type (Static, PHP, or Build)
8585
- Database creation (for PHP projects)
86+
- Build folder name (for Build projects)
8687
- Project structure generation
8788

8889
### 3. Deploy Your Website

ufazien-cli-js/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ ufazienjs create
5353

5454
The CLI will guide you through:
5555
- Website name and subdomain
56-
- Website type (Static or PHP)
56+
- Website type (Static, PHP, or Build)
5757
- Database creation (for PHP projects)
58+
- Build folder name (for Build projects)
5859
- Project structure generation
5960

6061
### Deploy Your Website
@@ -66,7 +67,7 @@ ufazienjs deploy
6667
```
6768

6869
This will:
69-
1. Create a ZIP archive of your project (excluding files in `.ufazienignore`)
70+
1. Create a ZIP archive of your project (excluding files in `.ufazienignore`, or from build folder for Build projects)
7071
2. Upload the files to your website
7172
3. Trigger the deployment
7273

ufazien-cli-js/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ program
131131
.description('Create a new website project')
132132
.option('-n, --name <name>', 'Website name')
133133
.option('-s, --subdomain <subdomain>', 'Subdomain')
134-
.option('-t, --type <type>', 'Website type (static or php)')
134+
.option('-t, --type <type>', 'Website type (static, php, or build)')
135135
.option('-d, --database', 'Create database (PHP only)')
136136
.action(async (options) => {
137137
console.log(chalk.cyan.bold('\n✨ Create New Website\n'));

ufazien-cli-py/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ ufazien create
5454

5555
The CLI will guide you through:
5656
- Website name and subdomain
57-
- Website type (Static or PHP)
57+
- Website type (Static, PHP, or Build)
5858
- Database creation (for PHP projects)
59+
- Build folder name (for Build projects)
5960
- Project structure generation
6061

6162
### Deploy Your Website
@@ -67,7 +68,7 @@ ufazien deploy
6768
```
6869

6970
This will:
70-
1. Create a ZIP archive of your project (excluding files in `.ufazienignore`)
71+
1. Create a ZIP archive of your project (excluding files in `.ufazienignore`, or from build folder for Build projects)
7172
2. Upload the files to your website
7273
3. Trigger the deployment
7374

ufazien-cli-py/src/ufazien/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Ufazien CLI - Command-line interface for deploying web applications on Ufazien platform.
33
"""
44

5-
__version__ = "0.1.7"
5+
__version__ = "0.2.0"
66

77
from ufazien.client import UfazienAPIClient
88

ufazien-cli-py/src/ufazien/cli.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from rich.prompt import Prompt, Confirm
1515
from rich.table import Table
1616

17+
from ufazien import __version__
1718
from ufazien.client import UfazienAPIClient
1819
from ufazien.utils import (
1920
create_zip,
@@ -33,12 +34,29 @@
3334
create_build_project_structure,
3435
)
3536

37+
console = Console()
38+
3639
app = typer.Typer(
3740
name="ufazien",
3841
help="🚀 Ufazien CLI - Deploy web applications on Ufazien platform",
3942
add_completion=False,
4043
)
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()
4260

4361

4462
def require_auth(client: UfazienAPIClient) -> None:
@@ -95,7 +113,7 @@ def logout() -> None:
95113
def create(
96114
name: Optional[str] = typer.Option(None, "--name", "-n", help="Website name"),
97115
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)"),
99117
database: bool = typer.Option(False, "--database", "-d", help="Create database (PHP only)"),
100118
) -> None:
101119
"""Create a new website project."""

ufazien-cli-py/src/ufazien/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def create_zip(project_dir: str, output_path: Optional[str] = None) -> str:
101101
ufazienignore_path = project_path / '.ufazienignore'
102102

103103
if output_path is None:
104-
output_path = tempfile.mktemp(suffix='.zip')
104+
fd, output_path = tempfile.mkstemp(suffix='.zip')
105+
os.close(fd)
105106

106107
with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
107108
for root, dirs, files in os.walk(project_path):
@@ -139,7 +140,8 @@ def create_zip_from_folder(project_dir: str, folder_name: str, output_path: Opti
139140
raise Exception(f"'{folder_name}' is not a directory.")
140141

141142
if output_path is None:
142-
output_path = tempfile.mktemp(suffix='.zip')
143+
fd, output_path = tempfile.mkstemp(suffix='.zip')
144+
os.close(fd)
143145

144146
with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
145147
for root, dirs, files in os.walk(build_folder_path):

0 commit comments

Comments
 (0)