parse drives
This commit is contained in:
parent
69e0faa278
commit
a179fb66c5
28
cmd/endpoint-v2.go
Normal file
28
cmd/endpoint-v2.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue