mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 20:06:19 +08:00
weed shell: simplify CLI option for filer
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -45,3 +46,18 @@ func ParseFilerUrl(entryPath string) (filerServer string, filerPort int64, path
|
||||
path = u.Path
|
||||
return
|
||||
}
|
||||
|
||||
func ParseHostPort(hostPort string) (filerServer string, filerPort int64, err error) {
|
||||
parts := strings.Split(hostPort, ":")
|
||||
if len(parts) != 2 {
|
||||
err = fmt.Errorf("failed to parse %s\n", hostPort)
|
||||
return
|
||||
}
|
||||
|
||||
filerPort, err = strconv.ParseInt(parts[1], 10, 64)
|
||||
if err == nil {
|
||||
filerServer = parts[0]
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user