From 1448fe6c2f75852d6540815de22ded67c7a78693 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 12 May 2026 18:57:40 +0200 Subject: [PATCH] Refactor API_URI handling to load from config and add command to set API URL --- rscli/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rscli/main.py b/rscli/main.py index fadd148..50fe719 100755 --- a/rscli/main.py +++ b/rscli/main.py @@ -5,14 +5,15 @@ from .config import Config from getpass import getpass from prettytable import PrettyTable import requests +from typing import Annotated VERSION = "1.0" -API_URI = "http://localhost:8080" + app = typer.Typer() config = Config() config.load() - +API_URI = config.get("API_URI") @app.command() def version(): print(f"Version: {VERSION}") @@ -34,7 +35,9 @@ def login(): config.save() 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__":