diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-30 11:04:38 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-30 11:04:38 +0200 |
| commit | 28bde5b10abf904212dfc3cae937112134293053 (patch) | |
| tree | b12aba30abeaba15a10458032e11e7d01cb69bd2 /firefly_cli/commands/auth.py | |
| parent | 49c9af4c213d5f420a405d860c0454fade26c297 (diff) | |
| download | firefly-cli-28bde5b10abf904212dfc3cae937112134293053.tar.gz firefly-cli-28bde5b10abf904212dfc3cae937112134293053.zip | |
feat: account, category, tag, auth commands
Diffstat (limited to 'firefly_cli/commands/auth.py')
| -rw-r--r-- | firefly_cli/commands/auth.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/firefly_cli/commands/auth.py b/firefly_cli/commands/auth.py new file mode 100644 index 0000000..d2319e9 --- /dev/null +++ b/firefly_cli/commands/auth.py @@ -0,0 +1,21 @@ +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> GPL-2.0-only +import getpass +from firefly_cli import registry, output, config + +def _set_args(p): + p.add_argument("--url", help="Firefly III base URL") + p.add_argument("--token", help="Personal Access Token") + +@registry.command("auth set", help="write url+token to config", args=_set_args) +def cmd_set(args, ctx): + url = args.url or input("Firefly III URL: ").strip() + token = args.token or getpass.getpass("Personal Access Token: ").strip() + path = config.write(url, token) + output.emit({"written": str(path)}, human=ctx.human) + return 0 + +@registry.command("auth test", help="verify connectivity and token") +def cmd_test(args, ctx): + resp = ctx.client.request("GET", "/api/v1/about") + output.emit(resp.get("data", resp), human=ctx.human) + return 0 |
