fix flag parser

This commit is contained in:
Christoph Polcin 2014-10-24 14:16:54 +02:00
parent 1cd7bd1100
commit d8aaad0e18

View File

@ -30,14 +30,16 @@ func main() {
root := flag.String("root", "URL", "WebDAV Endpoint") root := flag.String("root", "URL", "WebDAV Endpoint")
usr := flag.String("user", "", "user") usr := flag.String("user", "", "user")
pw := flag.String("pw", "", "password") pw := flag.String("pw", "", "password")
mm := strings.ToUpper(*(flag.String("X", "GET", "Method ..."))) m := flag.String("X", "GET", "Method ...")
m := &mm
flag.Parse() flag.Parse()
if *root == "URL" { if *root == "URL" {
Fail(nil) Fail(nil)
} }
M := strings.ToUpper(*m)
m = &M
c := d.NewClient(*root, *usr, *pw) c := d.NewClient(*root, *usr, *pw)
if err := c.Connect(); err != nil { if err := c.Connect(); err != nil {
Fail(fmt.Sprintf("Failed to connect due to: %s", err.Error())) Fail(fmt.Sprintf("Failed to connect due to: %s", err.Error()))