From fa51555f16769fc2c03114f025a667ac29ba88a1 Mon Sep 17 00:00:00 2001 From: Christoph Polcin Date: Fri, 25 May 2018 12:25:36 +0200 Subject: [PATCH] cmd: simplify arg handling --- cmd/gowebdav/main.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/gowebdav/main.go b/cmd/gowebdav/main.go index cf9bbc7..4a0c693 100644 --- a/cmd/gowebdav/main.go +++ b/cmd/gowebdav/main.go @@ -36,13 +36,7 @@ func main() { fail("Set WebDAV ROOT") } - var path0, path1 string - switch len(flag.Args()) { - case 1: - path0 = flag.Args()[0] - case 2: - path1 = flag.Args()[1] - default: + if l := len(flag.Args()); l == 0 || l > 2 { fail("Unsupported arguments") } @@ -53,7 +47,7 @@ func main() { cmd := getCmd(strings.ToUpper(*m)) - if e := cmd(c, path0, path1); e != nil { + if e := cmd(c, flag.Arg(0), flag.Arg(1)); e != nil { fail(e) } }