parse drives

This commit is contained in:
Harshavardhana 2021-07-19 12:33:55 -07:00
parent 69e0faa278
commit a179fb66c5
2 changed files with 28 additions and 0 deletions

28
cmd/endpoint-v2.go Normal file
View file

@ -0,0 +1,28 @@
package cmd
import (
"fmt"
"strings"
"github.com/minio/cli"
"github.com/minio/pkg/ellipses"
)
var (
globalMinioDrives string
)
const (
driveSeparator = "="
)
func parseDrives(cctx *cli.Context) (string, error) {
tokens := strings.SplitN(cctx.Args().First(), driveSeparator, 2)
if len(tokens) != 2 {
return "", fmt.Errorf("unable to parse input args %s", cctx.Args())
}
if !ellipses.HasEllipses(tokens[1]) {
return "", fmt.Errorf("unable to parse input args %s, only allows ellipses patterns", cctx.Args())
}
return tokens[1], nil
}