add Stat()

This commit is contained in:
Christoph Polcin
2014-10-27 17:02:28 +01:00
parent 328e74fe93
commit a3cc4ebe01
2 changed files with 55 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ func Fail(err interface{}) {
fmt.Println(" CP | COPY <OLD_PATH> <NEW_PATH>")
fmt.Println(" GET | PULL | READ <PATH>")
fmt.Println(" PUT | PUSH | WRITE <PATH> <FILE>")
fmt.Println(" STAT <PATH>")
}
os.Exit(-1)
}
@@ -73,6 +73,13 @@ func main() {
fmt.Println(err)
}
case "STAT":
if file, err := c.Stat(path); err == nil {
fmt.Println(file)
} else {
fmt.Println(err)
}
case "GET", "PULL", "READ":
if bytes, err := c.Read(path); err == nil {
if lidx := strings.LastIndex(path, "/"); lidx != -1 {