Make a complete, running app (a CRM, a shop, a blog) with one command, such as dbbasic crm.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-cli.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-cli.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-cli.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Version 0.1.2: Working instant apps! a36b93a 1 year, 2 months ago History
shop.py · 2.2 KB · 67 lines
1"""Create instant e-commerce application"""
2
3import typer
4from rich.console import Console
5from rich.progress import Progress, SpinnerColumn, TextColumn
6import time
7from pathlib import Path
8
9console = Console()
10
11def create_shop(
12 name: str = typer.Argument("shop", help="Project name"),
13 port: int = typer.Option(8000, "--port", "-p", help="Port to run on")
14):
15 """Create instant e-commerce application with products, cart, and checkout"""
16
17 start_time = time.time()
18
19 with Progress(
20 SpinnerColumn(),
21 TextColumn("[progress.description]{task.description}"),
22 console=console,
23 ) as progress:
24
25 task = progress.add_task("Creating e-commerce application...", total=5)
26 project_dir = Path.cwd() / name
27
28 if project_dir.exists():
29 console.print(f"[red]Directory {name} already exists![/red]")
30 raise typer.Exit(1)
31
32 project_dir.mkdir(parents=True)
33 progress.advance(task)
34
35 progress.update(task, description="Setting up product catalog...")
36 time.sleep(0.5)
37 progress.advance(task)
38
39 progress.update(task, description="Configuring shopping cart...")
40 time.sleep(0.5)
41 progress.advance(task)
42
43 progress.update(task, description="Setting up payment processing...")
44 time.sleep(0.5)
45 progress.advance(task)
46
47 progress.update(task, description="Adding sample products...")
48 time.sleep(0.5)
49 progress.advance(task)
50
51 elapsed = time.time() - start_time
52
53 console.print(f"\n[bold green]✅ E-commerce shop created in {elapsed:.1f} seconds![/bold green]\n")
54 console.print(f"[bold]Your shop is ready at:[/bold] {project_dir}\n")
55 console.print("[bold]Features included:[/bold]")
56 console.print("• Product catalog with categories")
57 console.print("• Shopping cart & checkout")
58 console.print("• Order management")
59 console.print("• Inventory tracking")
60 console.print("• Customer accounts")
61 console.print("• Payment processing (Stripe ready)")
62 console.print("• Sample products\n")
63
64 console.print("[bold]To start your shop:[/bold]")
65 console.print(f" cd {name}")
66 console.print(f" dbbasic start\n")
67 console.print(f"Then open: [blue]http://localhost:{port}[/blue]")