MCPcopy
hub / github.com/docker/compose / splitCpArg

Function splitCpArg

pkg/compose/cp.go:336–351  ·  pkg/compose/cp.go::splitCpArg
(arg string)

Source from the content-addressed store, hash-verified

334}
335
336func splitCpArg(arg string) (ctr, path string) {
337 if isAbs(arg) {
338 // Explicit local absolute path, e.g., `C:\foo` or `/foo`.
339 return "", arg
340 }
341
342 ctr, path, ok := strings.Cut(arg, ":")
343
344 if !ok || strings.HasPrefix(ctr, ".") {
345 // Either there's no `:` in the arg
346 // OR it's an explicit local relative path like `./file:name.txt`.
347 return "", arg
348 }
349
350 return ctr, path
351}
352
353func resolveLocalPath(localPath string) (absPath string, err error) {
354 if absPath, err = filepath.Abs(localPath); err != nil {

Callers 1

copyMethod · 0.85

Calls 1

isAbsFunction · 0.85

Tested by

no test coverage detected