mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-18 20:39:24 +08:00
simplify parsing filer host and port
This commit is contained in:
@@ -30,25 +30,19 @@ func (c *commandFsCd) Help() string {
|
||||
|
||||
func (c *commandFsCd) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||
|
||||
input := findInputDirectory(args)
|
||||
|
||||
filerServer, filerPort, path, err := commandEnv.parseUrl(input)
|
||||
path, err := commandEnv.parseUrl(findInputDirectory(args))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if path == "/" {
|
||||
commandEnv.option.FilerHost = filerServer
|
||||
commandEnv.option.FilerPort = filerPort
|
||||
commandEnv.option.Directory = "/"
|
||||
return nil
|
||||
}
|
||||
|
||||
err = commandEnv.checkDirectory(filerServer, filerPort, path)
|
||||
err = commandEnv.checkDirectory(path)
|
||||
|
||||
if err == nil {
|
||||
commandEnv.option.FilerHost = filerServer
|
||||
commandEnv.option.FilerPort = filerPort
|
||||
commandEnv.option.Directory = path
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user