simplify parsing filer host and port
This commit is contained in:
@@ -30,20 +30,18 @@ func (c *commandFsCat) Help() string {
|
||||
|
||||
func (c *commandFsCat) 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 commandEnv.isDirectory(filerServer, filerPort, path) {
|
||||
if commandEnv.isDirectory(path) {
|
||||
return fmt.Errorf("%s is a directory", path)
|
||||
}
|
||||
|
||||
dir, name := util.FullPath(path).DirAndName()
|
||||
|
||||
return commandEnv.withFilerClient(filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error {
|
||||
return commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Name: name,
|
||||
|
||||
Reference in New Issue
Block a user