Skip to content

Commit

Permalink
store name flag
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Nov 12, 2024
1 parent 2eceb45 commit 194772c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions versiondb/client/fixdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import (
"github.com/spf13/cobra"
)

const FlagDryRun = "dry-run"
const (
FlagDryRun = "dry-run"
FlagStore = "store-name"
)

func FixDataCmd(stores []string) *cobra.Command {
func FixDataCmd(defaultStores []string) *cobra.Command {
cmd := &cobra.Command{
Use: "fixdata <dir>",
Args: cobra.ExactArgs(1),
Expand All @@ -19,6 +22,13 @@ func FixDataCmd(stores []string) *cobra.Command {
if err != nil {
return err
}
stores, err := cmd.Flags().GetStringArray(FlagStore)
if err != nil {
return err
}
if len(stores) == 0 {
stores = defaultStores
}

var (
db *grocksdb.DB
Expand All @@ -44,5 +54,6 @@ func FixDataCmd(stores []string) *cobra.Command {
}

cmd.Flags().Bool(FlagDryRun, false, "Dry run, do not write to the database, open the database in read-only mode.")
cmd.Flags().StringArray(FlagStore, []string{}, "Store names to fix, if not specified, all stores will be fixed.")
return cmd
}

0 comments on commit 194772c

Please sign in to comment.