"""Local dev CLI for the CM bot. Mirrors Telegram /1, /2, /3 plus operational commands. No-arg invocation drops into a stdlib TUI menu. """ import argparse import sys from .cm_bot_hal import CM_BOT_HAL def cmd_interactive(_args): raise NotImplementedError("cmd_interactive is implemented in a later task") def _print_user(user: dict) -> None: print(f"Username: {user['username']}") print(f"Password: {user['password']}") print(f"Link: {user['link']}") def cmd_register(_args): bot = CM_BOT_HAL() _print_user(bot.get_user_api()) def build_parser() -> argparse.ArgumentParser: p = argparse.ArgumentParser( prog="bot_cli", description="CM Bot dev CLI (mirrors Telegram triggers).", ) sub = p.add_subparsers(dest="command") sp = sub.add_parser("register", aliases=["get-acc"], help="Get next available account (Telegram /1).") sp.set_defaults(func=cmd_register) return p def main(argv=None) -> int: parser = build_parser() args = parser.parse_args(argv) if args.command is None: return cmd_interactive(args) or 0 return args.func(args) or 0 if __name__ == "__main__": sys.exit(main())