-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (38 loc) · 1.11 KB
/
main.py
File metadata and controls
51 lines (38 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from typing import Optional
import typer
from commands import agent, common, config, dashboard, db
from core.updater import check_for_updates, update_cli
from core.utils import console, current_version
app = typer.Typer(no_args_is_help=True, add_completion=False)
def version_callback(value: bool):
if value:
console.print(f"Portabase CLI version: {current_version()}")
check_for_updates(force=True)
raise typer.Exit()
@app.callback()
def main(
ctx: typer.Context,
version: Optional[bool] = typer.Option(
None,
"--version",
help="Show the version and exit.",
callback=version_callback,
is_eager=True,
),
):
if ctx.invoked_subcommand != "update":
check_for_updates()
@app.command()
def update():
update_cli()
app.command()(agent.agent)
app.command()(dashboard.dashboard)
app.command()(common.start)
app.command()(common.stop)
app.command()(common.restart)
app.command()(common.logs)
app.command()(common.uninstall)
app.add_typer(db.app, name="db")
app.add_typer(config.app, name="config")
if __name__ == "__main__":
app()