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")
usr := flag.String("user", "", "user")
pw := flag.String("pw", "", "password")
mm := strings.ToUpper(*(flag.String("X", "GET", "Method ...")))
m := &mm
m := flag.String("X", "GET", "Method ...")
flag.Parse()
if *root == "URL" {
Fail(nil)
}
M := strings.ToUpper(*m)
m = &M
c := d.NewClient(*root, *usr, *pw)
if err := c.Connect(); err != nil {
Fail(fmt.Sprintf("Failed to connect due to: %s", err.Error()))