update cmd usage

This commit is contained in:
Christoph Polcin 2018-05-25 11:03:42 +02:00
parent c16034adb0
commit d6b82df09a
2 changed files with 33 additions and 15 deletions

View File

@ -14,26 +14,30 @@ go get -u github.com/studio-b12/gowebdav/cmd/gowebdav
## Usage
```sh
Usage: gowebdav FLAGS ARGS
Flags:
$ gowebdav --help
Usage of gowebdav
-X string
Method (default "GET")
Method:
LS <PATH>
STAT <PATH>
MKDIR <PATH>
MKDIRALL <PATH>
GET <PATH> <FILE>
PUT <PATH> <FILE>
MV <OLD> <NEW>
CP <OLD> <NEW>
DEL <PATH>
-pw string
Password [ENV.PASSWORD]
-root string
WebDAV Endpoint [ENV.ROOT]
-user string
User [ENV.USER]
Method <ARGS>
LS | LIST | PROPFIND <PATH>
STAT <PATH>
RM | DELETE | DEL <PATH>
MKDIR | MKCOL <PATH>
MKDIRALL | MKCOLALL <PATH>
MV | MOVE | RENAME <OLD_PATH> <NEW_PATH>
CP | COPY <OLD_PATH> <NEW_PATH>
GET | PULL | READ <PATH> <FILE>
PUT | PUSH | WRITE <PATH> <FILE>
```
*Example*

View File

@ -14,7 +14,21 @@ func main() {
root := flag.String("root", os.Getenv("ROOT"), "WebDAV Endpoint [ENV.ROOT]")
usr := flag.String("user", os.Getenv("USER"), "User [ENV.USER]")
pw := flag.String("pw", os.Getenv("PASSWORD"), "Password [ENV.PASSWORD]")
m := flag.String("X", "GET", "Method")
m := flag.String("X", "", `Method:
LS <PATH>
STAT <PATH>
MKDIR <PATH>
MKDIRALL <PATH>
GET <PATH> <FILE>
PUT <PATH> <FILE>
MV <OLD> <NEW>
CP <OLD> <NEW>
DEL <PATH>
`)
flag.Parse()
if *root == "" {
@ -67,7 +81,7 @@ func getCmd(method string) func(c *d.Client, p0, p1 string) error {
case "MKCOL", "MKDIR":
return cmdMkdir
case "MKCOLALL", "MKDIRALL":
case "MKCOLALL", "MKDIRALL", "MKDIRP":
return cmdMkdirAll
case "RENAME", "MV", "MOVE":