mirror of
https://github.com/restic/restic.git
synced 2026-11-02 13:35:33 +00:00
move cli flags into AddFlags on option structs
This commit is contained in:
1 parent
da47967316
commit
dc9b6378f3
24 files changed
+307
-231
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/restic/restic/internal/ui/termstatus"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
var cmdMigrate = &cobra.Command{
|
||||
@@ -42,12 +43,15 @@ type MigrateOptions struct {
|
||||
Force bool
|
||||
}
|
||||
|
||||
func (opts *MigrateOptions) AddFlags(f *pflag.FlagSet) {
|
||||
f.BoolVarP(&opts.Force, "force", "f", false, `apply a migration a second time`)
|
||||
}
|
||||
|
||||
var migrateOptions MigrateOptions
|
||||
|
||||
func init() {
|
||||
cmdRoot.AddCommand(cmdMigrate)
|
||||
f := cmdMigrate.Flags()
|
||||
f.BoolVarP(&migrateOptions.Force, "force", "f", false, `apply a migration a second time`)
|
||||
migrateOptions.AddFlags(cmdMigrate.Flags())
|
||||
}
|
||||
|
||||
func checkMigrations(ctx context.Context, repo restic.Repository, printer progress.Printer) error {
|
||||
|
||||
Reference in new issue
Block a user