From 892e726eb9c2427634c46f8ae9b7bcf0b6d1b082 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 25 Feb 2020 21:50:12 -0800 Subject: avoid reusing context object fix https://github.com/chrislusf/seaweedfs/issues/1182 --- weed/shell/command_fs_cd.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'weed/shell/command_fs_cd.go') diff --git a/weed/shell/command_fs_cd.go b/weed/shell/command_fs_cd.go index 408ec86c8..df42cd516 100644 --- a/weed/shell/command_fs_cd.go +++ b/weed/shell/command_fs_cd.go @@ -1,7 +1,6 @@ package shell import ( - "context" "io" ) @@ -45,9 +44,7 @@ func (c *commandFsCd) Do(args []string, commandEnv *CommandEnv, writer io.Writer return nil } - ctx := context.Background() - - err = commandEnv.checkDirectory(ctx, filerServer, filerPort, path) + err = commandEnv.checkDirectory(filerServer, filerPort, path) if err == nil { commandEnv.option.FilerHost = filerServer -- cgit v1.2.3 From d151185b7e5c7912afc38a36c163ef87eedcde3d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 23 Mar 2020 20:46:17 -0700 Subject: shell: desupport filer url in the arguments --- weed/shell/command_fs_cd.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'weed/shell/command_fs_cd.go') diff --git a/weed/shell/command_fs_cd.go b/weed/shell/command_fs_cd.go index df42cd516..377fd40f7 100644 --- a/weed/shell/command_fs_cd.go +++ b/weed/shell/command_fs_cd.go @@ -16,14 +16,14 @@ func (c *commandFsCd) Name() string { } func (c *commandFsCd) Help() string { - return `change directory to http://:/dir/ + return `change directory to a directory /path/to/dir The full path can be too long to type. For example, - fs.ls http://:/some/path/to/file_name + fs.ls /some/path/to/file_name can be simplified as - fs.cd http://:/some/path + fs.cd /some/path fs.ls to/file_name ` } -- cgit v1.2.3 From e666aeece2778812a4a9d3fc4daaaac86fe4a412 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 23 Mar 2020 21:26:15 -0700 Subject: simplify parsing filer host and port --- weed/shell/command_fs_cd.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'weed/shell/command_fs_cd.go') diff --git a/weed/shell/command_fs_cd.go b/weed/shell/command_fs_cd.go index 377fd40f7..2cc28f7a2 100644 --- a/weed/shell/command_fs_cd.go +++ b/weed/shell/command_fs_cd.go @@ -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 } -- cgit v1.2.3