aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_fs_du.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-04-04 19:27:51 -0700
committerChris Lu <chris.lu@gmail.com>2019-04-04 19:27:51 -0700
commitaf37b374cbe915f033058abad98d648ccce70d5c (patch)
treedeb4704677e0ac8c660bb81e6e991c38aa22f5f0 /weed/shell/command_fs_du.go
parent766396d249652c1b29771fa1fce65250f9707d1d (diff)
downloadseaweedfs-af37b374cbe915f033058abad98d648ccce70d5c.tar.xz
seaweedfs-af37b374cbe915f033058abad98d648ccce70d5c.zip
weed shell: fs.cd change current directory
Diffstat (limited to 'weed/shell/command_fs_du.go')
-rw-r--r--weed/shell/command_fs_du.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/weed/shell/command_fs_du.go b/weed/shell/command_fs_du.go
index 98e2eebd1..f305cabdc 100644
--- a/weed/shell/command_fs_du.go
+++ b/weed/shell/command_fs_du.go
@@ -8,7 +8,6 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
"google.golang.org/grpc"
"io"
- "strings"
)
func init() {
@@ -33,21 +32,18 @@ func (c *commandFsDu) Help() string {
func (c *commandFsDu) Do(args []string, commandEnv *commandEnv, writer io.Writer) (err error) {
- filerServer, filerPort, path, err := commandEnv.parseUrl(args[0])
+ filerServer, filerPort, path, err := commandEnv.parseUrl(findInputDirectory(args))
if err != nil {
return err
}
- dir, name := filer2.FullPath(path).DirAndName()
- if strings.HasSuffix(path, "/") {
- if path == "/" {
- dir, name = "/", ""
- } else {
- dir, name = path[0 : len(path)-1], ""
- }
+ ctx := context.Background()
+
+ if commandEnv.isDirectory(ctx, filerServer, filerPort, path) {
+ path = path + "/"
}
- ctx := context.Background()
+ dir, name := filer2.FullPath(path).DirAndName()
return commandEnv.withFilerClient(ctx, filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error {