func migrationPreRun()

in cmd/client/command/migrate.go [66:89]


func migrationPreRun(_ *cobra.Command, args []string) error {
	if len(args) < 1 {
		return fmt.Errorf("resource type should be specified")
	}
	if len(args) < 2 {
		return fmt.Errorf("the slot number should be specified")
	}
	_, err := store.ParseSlotRange(args[1])
	if err != nil {
		return fmt.Errorf("invalid slot number: %s, error: %w", args[1], err)
	}
	migrateOptions.slot = args[1]

	if migrateOptions.namespace == "" {
		return fmt.Errorf("namespace is required, please specify with -n or --namespace")
	}
	if migrateOptions.cluster == "" {
		return fmt.Errorf("cluster is required, please specify with -c or --cluster")
	}
	if migrateOptions.target < 0 {
		return fmt.Errorf("target is required, please specify with --target")
	}
	return nil
}