mirror of https://github.com/milvus-io/milvus.git
36 lines
688 B
Go
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))
|
|
}
|
|
}
|