Files
HackBrowserData/cmd/hack-browser-data/flags.go
Roger a734e777a8 refactor(app): export one function per command (#712)
* refactor(app): export one function per command

Step 2 of #710. A command's logic was split between cmd and stage-shaped app calls; cmd now parses flags, calls one function and prints what it returns. An error means the command never ran, and a run that ended early says so in Summary.Err.

* fix(app): check dumpkeys and archive -o up front

A missing output directory was reported only after the keys were retrieved or the files copied.

* docs(rfcs): move restore's input out of the command layer

Restore now discovers its directories in an archive itself, so the command layer no longer holds the data it reads.
2026-11-22 14:45:39 +08:00

16 lines
692 B
Go

package main
import (
"github.com/spf13/cobra"
"github.com/moond4rk/hackbrowserdata/internal/app"
)
// addOutputFlags defines the output flags once, so dump and restore keep one wording and one set of defaults.
func addOutputFlags(command *cobra.Command, flags *app.OutputFlags) {
command.Flags().StringVarP(&flags.Format, "format", "f", "json", "output format: csv|json|cookie-editor")
command.Flags().StringVarP(&flags.Dir, "dir", "d", "results", "output directory")
command.Flags().BoolVar(&flags.Zip, "zip", false, "compress output to zip")
command.Flags().IntVar(&flags.MaxStorageValue, "max-storage-value", app.DefaultMaxStorageValue, "max storage value chars, 0=unlimited")
}