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 ## Usage
```sh ```sh
Usage: gowebdav FLAGS ARGS $ gowebdav --help
Flags: Usage of gowebdav
-X string -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 -pw string
Password [ENV.PASSWORD] Password [ENV.PASSWORD]
-root string -root string
WebDAV Endpoint [ENV.ROOT] WebDAV Endpoint [ENV.ROOT]
-user string -user string
User [ENV.USER] 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* *Example*

View File

@ -14,7 +14,21 @@ func main() {
root := flag.String("root", os.Getenv("ROOT"), "WebDAV Endpoint [ENV.ROOT]") root := flag.String("root", os.Getenv("ROOT"), "WebDAV Endpoint [ENV.ROOT]")
usr := flag.String("user", os.Getenv("USER"), "User [ENV.USER]") usr := flag.String("user", os.Getenv("USER"), "User [ENV.USER]")
pw := flag.String("pw", os.Getenv("PASSWORD"), "Password [ENV.PASSWORD]") 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() flag.Parse()
if *root == "" { if *root == "" {
@ -67,7 +81,7 @@ func getCmd(method string) func(c *d.Client, p0, p1 string) error {
case "MKCOL", "MKDIR": case "MKCOL", "MKDIR":
return cmdMkdir return cmdMkdir
case "MKCOLALL", "MKDIRALL": case "MKCOLALL", "MKDIRALL", "MKDIRP":
return cmdMkdirAll return cmdMkdirAll
case "RENAME", "MV", "MOVE": case "RENAME", "MV", "MOVE":