Refactor API_URI handling to load from config and add command to set API URL

This commit is contained in:
2026-05-12 18:57:40 +02:00
parent d7588aa369
commit 1448fe6c2f
+6 -3
View File
@@ -5,14 +5,15 @@ from .config import Config
from getpass import getpass from getpass import getpass
from prettytable import PrettyTable from prettytable import PrettyTable
import requests import requests
from typing import Annotated
VERSION = "1.0" VERSION = "1.0"
API_URI = "http://localhost:8080"
app = typer.Typer() app = typer.Typer()
config = Config() config = Config()
config.load() config.load()
API_URI = config.get("API_URI")
@app.command() @app.command()
def version(): def version():
print(f"Version: {VERSION}") print(f"Version: {VERSION}")
@@ -34,7 +35,9 @@ def login():
config.save() config.save()
print(table) print(table)
@app.command()
def api_uri(url: Annotated[str, typer.Argument(help="The API Url (without /api...)")]):
config.set("API_URI", url)
if __name__ == "__main__": if __name__ == "__main__":