INNER CODE UNIT · Python
cmd_ledger
2akouwu/reverify · reverify/cli.py:398
def cmd_ledger(args: argparse.Namespace) -> None:
# Hook hosts read stdout as UTF-8; a legacy Windows code page must not garble or crash the hand-off.
reconfigure = getattr(sys.stdout, "reconfigure", None)
if callable(reconfigure):
try:
reconfigure(encoding="utf-8", errors="replace")
except (ValueError, OSError):
pass
if args.hook:
print(json.dumps(hook_config(), indent=2))
return
if args.context:
text = context_for_directory(args.dir, mode="facts" if args.full else "index", max_facts=args.max_facts)
if text:
print(text)
return
if not args.target:
leds = list_ledgers(args.dir)