diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-04-03 00:20:00 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-04-03 00:20:00 -0700 |
| commit | 715a38da1e4fce05631f230ccf09ce92c99a4fd4 (patch) | |
| tree | dc443bbe30b2178f24c67c19ef732013b8cabd0f /weed/shell/command_fs_ls.go | |
| parent | 20dcb44077bcb8164b8351ee506af8385e8fd6ef (diff) | |
| download | seaweedfs-715a38da1e4fce05631f230ccf09ce92c99a4fd4.tar.xz seaweedfs-715a38da1e4fce05631f230ccf09ce92c99a4fd4.zip | |
weed shell: add fs.cd, fs.pwd to change to a directory and print current directory
Diffstat (limited to 'weed/shell/command_fs_ls.go')
| -rw-r--r-- | weed/shell/command_fs_ls.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/weed/shell/command_fs_ls.go b/weed/shell/command_fs_ls.go index b94f24694..7b8d1d0cc 100644 --- a/weed/shell/command_fs_ls.go +++ b/weed/shell/command_fs_ls.go @@ -44,17 +44,29 @@ func (c *commandFsLs) Do(args []string, commandEnv *commandEnv, writer io.Writer } } - filerServer, filerPort, path, err := parseFilerUrl(args[len(args)-1]) + input := "" + if len(args) > 0 { + input = args[len(args)-1] + if strings.HasPrefix(input, "-") { + input = "" + } + } + + filerServer, filerPort, path, err := commandEnv.parseUrl(input) if err != nil { return err } + if input == "" && !strings.HasSuffix(path, "/") { + path = path + "/" + } dir, name := filer2.FullPath(path).DirAndName() + // println("path", path, "dir", dir, "name", name) if strings.HasSuffix(path, "/") { if path == "/" { dir, name = "/", "" } else { - dir, name = path[0:len(path)-1], "" + dir, name = path[0 : len(path)-1], "" } } |
