Refactor API_URI handling to load from config and add command to set API URL
This commit is contained in:
+6
-3
@@ -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__":
|
||||
|
||||
Reference in New Issue
Block a user