feat(cli): list/get 子命令 — 脚本集成 TOTP 获取

- winauth list: tabwriter 列出所有条目(名称/vendor/icon/hotkey)
- winauth get NAME: 输出当前 OTP,-n 不换行,--advance 允许 HOTP
- 加密配置自动 tty 隐藏密码提示(golang.org/x/term)
- --config 改为 PersistentFlag,子命令可继承
- HOTP get 默认拒绝,需 --advance 显式确认并保存配置
- CLI 不运行 GUI、不持有单实例锁
This commit is contained in:
2026-06-12 09:50:07 +08:00
parent 969600b6ee
commit 727be3557a
7 changed files with 265 additions and 7 deletions
+4 -1
View File
@@ -91,9 +91,12 @@ func main() {
"Log level: panic|fatal|error|warn|info|debug|trace (or 0..6)")
root.Flags().StringVar(&logFile, "log-file", "",
"If set, also write logs to this file in addition to the console")
root.Flags().StringVar(&configPath, "config", "",
root.PersistentFlags().StringVar(&configPath, "config", "",
"Path to the YAML config file (default: %APPDATA%\\winauth-go\\config.yaml or $XDG_CONFIG_HOME/winauth-go/config.yaml)")
root.AddCommand(newListCmd())
root.AddCommand(newGetCmd())
if err := root.Execute(); err != nil {
fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(1)