Jiquan Long a8a074162f
Add meta migration tool (#19709)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
2022-10-12 11:37:23 +08:00

36 lines
688 B
Go

package command
import (
"flag"
"fmt"
"os"
"github.com/milvus-io/milvus/cmd/tools/migration/console"
"github.com/milvus-io/milvus/cmd/tools/migration/configs"
)
func Execute(args []string) {
flags := flag.NewFlagSet(args[0], flag.ExitOnError)
flags.Usage = func() {
fmt.Fprintln(os.Stderr, usageLineV2)
}
c := &commandParser{}
c.format(args, flags)
console.ErrorExitIf(c.configYaml == "", "config not set")
cfg := configs.NewConfig(c.configYaml)
switch cfg.Cmd {
case configs.RunCmd:
Run(cfg)
case configs.BackupCmd:
Backup(cfg)
case configs.RollbackCmd:
Rollback(cfg)
default:
console.Exit(fmt.Sprintf("cmd not set or not supported: %s", cfg.Cmd))
}
}