tgs whoami#
显示当前配置文件名称和账户信息。从本地存储读取——无需连接 Telegram。
用法#
tgs whoami [flags]参数#
| Flag | Short | Default | Description |
|---|---|---|---|
--profile | -p | (resolved) | Profile to inspect |
--output | -o | json | Output format: json, text |
未设置 --profile 时的配置文件解析顺序:TGS_PROFILE 环境变量 → .tgs.yaml 文件 → "default"。
示例#
# Show current profile (JSON output)
tgs whoami
# Human-readable output
tgs whoami --output text
# Inspect a specific profile
tgs whoami --profile work
# Inspect a profile with text output
tgs whoami --profile work --output text输出#
文本输出 (--output text):
Profile: work
User: John Doe (id: 123456789)
Handle: @johndoe
Phone: +1234567890{
"profile": "work",
"user": {
"id": 123456789,
"phone": "+1234567890",
"username": "johndoe",
"first_name": "John",
"last_name": "Doe"
}
}如果配置文件存在但未登录,user 字段在 JSON 中为 null,在文本中显示为 "Not logged in"。