mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
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.
This commit is contained in:
1 parent
6ddfe48493
commit
a734e777a8
35 files changed
+513
-439
No files matched your search
@@ -0,0 +1,15 @@
|
||||
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")
|
||||
}
|
||||
Reference in new issue
Block a user