This commit is contained in:
root 2025-07-12 18:33:34 +08:00
parent d3aa746e0b
commit 69214ee7ae
2 changed files with 4 additions and 12 deletions

View File

@ -23,23 +23,15 @@ def register_user(
username: str = typer.Argument(..., help="用户名"),
email: str = typer.Argument(..., help="邮箱地址"),
display_name: Optional[str] = typer.Option(None, "--display-name", "-d", help="显示名称"),
password: Optional[str] = typer.Option(None, "--password", "-p", help="密码(不提供则交互式输入)"),
verbose: bool = typer.Option(False, "--verbose", "-v", help="详细输出"),
json_output: bool = typer.Option(False, "--json", help="JSON格式输出")
password: Optional[str] = typer.Option(None, "--password", "-p", help="密码(不提供则交互式输入)")
):
"""注册新用户"""
try:
response = create_response_handler(uuid4())
console.print(f"🆕 [bold blue]用户注册[/bold blue]")
console.print(f"用户名: {username}")
console.print(f"邮箱: {email}")
if display_name:
console.print(f"显示名称: {display_name}")
# 获取密码
if not password:
response.error("[red]❌ 密码不能为空[/red]")
response.error("❌ 密码不能为空")
raise typer.Exit(1)
# 执行注册
@ -51,7 +43,7 @@ def register_user(
})
response.success(result)
except Exception as e:
console.print(f"[red]❌ 注册失败: {str(e)}[/red]")
response.error(f"❌ 注册失败: {str(e)}")
raise typer.Exit(1)

View File

@ -136,7 +136,7 @@ class PythonCliAuth {
json_output: true
}
});
console.log({ response })
if (!response.success) {
throw new Error(response.error || response.message || 'Registration failed');
}