in src/huggingface_hub/commands/user.py [0:0]
def register_subcommand(parser: _SubParsersAction):
login_parser = parser.add_parser("login", help="Log in using a token from huggingface.co/settings/tokens")
login_parser.add_argument(
"--token",
type=str,
help="Token generated from https://huggingface.co/settings/tokens",
)
login_parser.add_argument(
"--add-to-git-credential",
action="store_true",
help="Optional: Save token to git credential helper.",
)
login_parser.set_defaults(func=lambda args: LoginCommand(args))
whoami_parser = parser.add_parser("whoami", help="Find out which huggingface.co account you are logged in as.")
whoami_parser.set_defaults(func=lambda args: WhoamiCommand(args))
logout_parser = parser.add_parser("logout", help="Log out")
logout_parser.add_argument(
"--token-name",
type=str,
help="Optional: Name of the access token to log out from.",
)
logout_parser.set_defaults(func=lambda args: LogoutCommand(args))
auth_parser = parser.add_parser("auth", help="Other authentication related commands")
auth_subparsers = auth_parser.add_subparsers(help="Authentication subcommands")
auth_switch_parser = auth_subparsers.add_parser("switch", help="Switch between access tokens")
auth_switch_parser.add_argument(
"--token-name",
type=str,
help="Optional: Name of the access token to switch to.",
)
auth_switch_parser.add_argument(
"--add-to-git-credential",
action="store_true",
help="Optional: Save token to git credential helper.",
)
auth_switch_parser.set_defaults(func=lambda args: AuthSwitchCommand(args))
auth_list_parser = auth_subparsers.add_parser("list", help="List all stored access tokens")
auth_list_parser.set_defaults(func=lambda args: AuthListCommand(args))