fix(restore): polish help text, drop dead check, dedup dump kinds

pflag treats backticked words in flag usage as the value placeholder,
so --data-zip rendered as "--data-zip archive" in help output.
This commit is contained in:
moonD4rk
2026-06-10 10:48:23 +08:00
parent 6d0efadb59
commit 72a046c4d6
2 changed files with 12 additions and 15 deletions
+1 -4
View File
@@ -57,7 +57,7 @@ func restoreCmd() *cobra.Command {
cmd.Flags().StringVar(&keysPath, "keys", "", "keys file from dumpkeys (use - for stdin)")
cmd.Flags().StringVar(&dataDir, "data-dir", "", "copied profile data dir (archive layout, or one browser's User Data with -b)")
cmd.Flags().StringVar(&dataZip, "data-zip", "", "archive zip from `archive` (alternative to --data-dir)")
cmd.Flags().StringVar(&dataZip, "data-zip", "", "zip produced by the archive command (alternative to --data-dir)")
cmd.Flags().StringVarP(&browserName, "browser", "b", "", "restore only this browser (optional; must match a vault in --keys)")
cmd.Flags().StringVarP(&category, "category", "c", "all", "data categories (comma-separated): all|"+categoryNames())
cmd.Flags().StringVarP(&outputFormat, "format", "f", "json", "output format: csv|json|cookie-editor")
@@ -74,9 +74,6 @@ func loadRestoreBrowsers(keysPath, dataDir, browserName string) ([]browser.Brows
if keysPath == "" {
return nil, fmt.Errorf("requires --keys <file> (or - for stdin)")
}
if dataDir == "" {
return nil, fmt.Errorf("requires --data-dir <dir>")
}
var r io.Reader = os.Stdin
if keysPath != "-" {