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
ports.py · 1.6 KB · 54 lines
1"""List ports used by DBBasic services"""
2
3import socket
4import typer
5from rich.console import Console
6from rich.table import Table
7
8from .config import SERVICES
9
10console = Console()
11
12def check_port(port):
13 """Check if port is in use"""
14 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
15 result = sock.connect_ex(('localhost', port))
16 sock.close()
17 return result == 0
18
19def ports():
20 """List ports used by DBBasic services"""
21
22 table = Table(title="DBBasic Port Usage")
23 table.add_column("Service", style="cyan")
24 table.add_column("Port", style="magenta")
25 table.add_column("Status", style="bold")
26 table.add_column("URL", style="blue")
27
28 for svc_name, svc in SERVICES.items():
29 port_in_use = check_port(svc['port'])
30 status = "✅ Active" if port_in_use else "⚪ Available"
31 color = "green" if port_in_use else "dim"
32
33 table.add_row(
34 svc['name'],
35 str(svc['port']),
36 f"[{color}]{status}[/{color}]",
37 svc['url']
38 )
39
40 console.print(table)
41
42 # Check for conflicts on common ports
43 console.print("\n[bold]Checking for port conflicts...[/bold]")
44 conflicts = []
45
46 for port in [3000, 3001, 5000, 5001, 8000, 8001, 8080, 8888]:
47 if port not in [s['port'] for s in SERVICES.values()]:
48 if check_port(port):
49 conflicts.append(port)
50
51 if conflicts:
52 console.print(f"[yellow]⚠️ Other services detected on ports: {', '.join(map(str, conflicts))}[/yellow]")
53 else:
54 console.print("[green]✅ No port conflicts detected[/green]")