mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-06-29 22:00:42 +02:00
adjusting command options
This commit is contained in:
parent
a5be4a6d40
commit
185a916f5e
|
@ -42,7 +42,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdCopy = &Command{
|
var cmdCopy = &Command{
|
||||||
UsageLine: "copy file_or_dir1 [file_or_dir2 file_or_dir3] http://localhost:8888/path/to/a/folder/",
|
UsageLine: "filer.copy file_or_dir1 [file_or_dir2 file_or_dir3] http://localhost:8888/path/to/a/folder/",
|
||||||
Short: "copy one or a list of files to a filer folder",
|
Short: "copy one or a list of files to a filer folder",
|
||||||
Long: `copy one or a list of files, or batch copy one whole folder recursively, to a filer folder
|
Long: `copy one or a list of files, or batch copy one whole folder recursively, to a filer folder
|
||||||
|
|
||||||
|
@ -75,13 +75,13 @@ func runCopy(cmd *Command, args []string) bool {
|
||||||
fmt.Printf("The last argument should be a URL on filer: %v\n", err)
|
fmt.Printf("The last argument should be a URL on filer: %v\n", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(fileOrDirs) > 1 && !strings.HasSuffix(filerUrl.Path, "/") {
|
path := filerUrl.Path
|
||||||
fmt.Println("Can not copy multiple items to a file. The last argument must be a folder ended with \"/\"")
|
if !strings.HasSuffix(path, "/") {
|
||||||
return false
|
path = path + "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, fileOrDir := range fileOrDirs {
|
for _, fileOrDir := range fileOrDirs {
|
||||||
if !doEachCopy(fileOrDir, filerUrl.Host, filerUrl.Path) {
|
if !doEachCopy(fileOrDir, filerUrl.Host, path) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ func doEachCopy(fileOrDir string, host string, path string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Copy %s => http://%s/%s\n", fileOrDir, host, path)
|
fmt.Printf("Copy %s => http://%s%s\n", fileOrDir, host, path)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
Loading…
Reference in a new issue