Skip to content

Commit

Permalink
cleanup: sync doesn't need flags
Browse files Browse the repository at this point in the history
  • Loading branch information
t0t07 committed Nov 15, 2021
1 parent 92d55b0 commit fde1543
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions featctl/cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"context"
"log"
"strconv"

"github.com/oom-ai/oomstore/pkg/oomstore/types"
"github.com/spf13/cobra"
Expand All @@ -14,6 +15,13 @@ var syncCmd = &cobra.Command{
Use: "sync",
Short: "sync feature values from offline store to online store",
Args: cobra.ExactArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
i, err := strconv.ParseInt(args[0], 10, 32)
if err != nil {
log.Fatalf("illegal revisionID: '%s' cannot be parsed into int32", args[0])
}
syncOpt.RevisionId = int32(i)
},
Run: func(cmd *cobra.Command, args []string) {
ctx := context.Background()
oomStore := mustOpenOomStore(ctx, oomStoreCfg)
Expand All @@ -29,9 +37,4 @@ var syncCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(syncCmd)

flags := syncCmd.Flags()

flags.Int32VarP(&syncOpt.RevisionId, "revision-id", "r", 0, "group revision id")
_ = syncCmd.MarkFlagRequired("revision-id")
}
2 changes: 1 addition & 1 deletion featctl/test/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import_sample() {
sync() {
info "sync sample data to online store"
echo $1
featctl sync phone -r $1
featctl sync $1
}

execute_sql() {
Expand Down

0 comments on commit fde1543

Please sign in to comment.