MCPcopy Create free account
hub / github.com/dropbox/dbxcli / getWithClient

Function getWithClient

cmd/get.go:217–236  ·  view source on GitHub ↗
(dbx filesClient, args []string)

Source from the content-addressed store, hash-verified

215}
216
217func 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
238func getRecursive(dbx filesClient, src, dst string) error {
239 _, err := getRecursiveInternal(dbx, src, dst, nil, getOptions{}, false)

Callers 2

Calls 8

argumentsErrorDetailsFunction · 0.85
validatePathFunction · 0.85
withJSONErrorDetailsFunction · 0.85
downloadFileFunction · 0.85
operationErrorDetailsFunction · 0.85
pathErrorDetailsFunction · 0.85
relocationErrorDetailsFunction · 0.85

Tested by 2