From e0b778960b1fa20b094209b106a3a2c72b091009 Mon Sep 17 00:00:00 2001 From: Christoph Polcin Date: Fri, 25 May 2018 12:18:30 +0200 Subject: [PATCH] cmd: GET with optional FILE argument --- cmd/gowebdav/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/gowebdav/main.go b/cmd/gowebdav/main.go index 74f9997..cf9bbc7 100644 --- a/cmd/gowebdav/main.go +++ b/cmd/gowebdav/main.go @@ -22,7 +22,7 @@ func main() { MKDIR MKDIRALL - GET + GET [] PUT MV @@ -123,7 +123,11 @@ func cmdStat(c *d.Client, p0, _ string) (err error) { func cmdGet(c *d.Client, p0, p1 string) (err error) { bytes, err := c.Read(p0) if err == nil { - if err = writeFile(p1, bytes, 0644); err == nil { + if p1 == "" { + p1 = filepath.Join(".", p0) + } + err = writeFile(p1, bytes, 0644) + if err == nil { fmt.Println(fmt.Sprintf("Written %d bytes to: %s", len(bytes), p1)) } }