| 215 | } |
| 216 | |
| 217 | func getWithClient(dbx filesClient, args []string) (err error) { |
| 218 | if len(args) == 0 || len(args) > 2 { |
| 219 | return invalidArgumentsErrorWithDetails("`get` requires `src` and/or `dst` arguments", argumentsErrorDetails("src", "dst")) |
| 220 | } |
| 221 | |
| 222 | src, err := validatePath(args[0]) |
| 223 | if err != nil { |
| 224 | return |
| 225 | } |
| 226 | |
| 227 | dst := path.Base(src) |
| 228 | if len(args) == 2 { |
| 229 | dst = args[1] |
| 230 | } |
| 231 | if f, err := os.Stat(dst); err == nil && f.IsDir() { |
| 232 | dst = filepath.Join(dst, path.Base(src)) |
| 233 | } |
| 234 | |
| 235 | return withJSONErrorDetails(downloadFile(dbx, src, dst), operationErrorDetails("download"), pathErrorDetails(src), relocationErrorDetails(src, dst)) |
| 236 | } |
| 237 | |
| 238 | func getRecursive(dbx filesClient, src, dst string) error { |
| 239 | _, err := getRecursiveInternal(dbx, src, dst, nil, getOptions{}, false) |