Add explicit sorter account flag

The prompts used to arrive at this change since the previous commit

For what account is this working?
Add the account name flag

Any special observations that may be relevant for version management for this version. Be brief.

config.py already supported --account globally; verplaats_bestaand.py now documents, validates, and displays the selected account explicitly.
This commit is contained in:
2026-07-04 16:40:06 +02:00
parent 8712052332
commit e062db2fb6
2 changed files with 20 additions and 4 deletions
+18 -3
View File
@@ -13,7 +13,8 @@ Stap 2 Per-bericht routing:
Stap 3 Facturen per kwartaal sorteren (Facturen - te verwerken).
Standaard: DRY RUN (laat zien wat er zou gebeuren, verplaatst niets).
Echt uitvoeren: python3 verplaats_bestaand.py --uitvoeren
Account kiezen: python3 verplaats_bestaand.py --account backup --audit
Echt uitvoeren: python3 verplaats_bestaand.py --account backup --uitvoeren
Log: verplaats_log.json
"""
@@ -526,6 +527,19 @@ def load_log() -> dict:
return {}
def account_name_from_args() -> str | None:
args = sys.argv[1:]
if "--account" not in args:
return None
idx = args.index("--account")
if idx + 1 >= len(args) or args[idx + 1].startswith("--"):
print("Gebruik: python3 verplaats_bestaand.py --account <naam> [--audit|--uitvoeren]")
sys.exit(1)
return args[idx + 1]
# ── main ──────────────────────────────────────────────────────────────────────
def run():
@@ -545,8 +559,9 @@ def run():
print("Afgebroken.")
sys.exit(0)
cfg = config.load()
print(f"Account: {cfg.username}\n")
account_name = account_name_from_args()
cfg = config.load(account_name)
print(f"Account: {cfg.name} ({cfg.username})\n")
print(f"Verbinden met {cfg.imap_host}:{cfg.imap_port} ...")
session = ImapSession(cfg)