MCPcopy Index your code
hub / github.com/devspace-sh/devspace / ParseSyncPath

Function ParseSyncPath

pkg/devspace/services/sync/controller.go:297–321  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

295}
296
297func ParseSyncPath(path string) (localPath string, remotePath string, err error) {
298 if path == "" {
299 return ".", ".", nil
300 }
301
302 splitted := strings.Split(path, ":")
303 if len(splitted) > 2 {
304 newSplitted := []string{}
305 newSplitted = append(newSplitted, strings.Join(splitted[0:len(splitted)-1], ":"))
306 newSplitted = append(newSplitted, splitted[len(splitted)-1])
307 splitted = newSplitted
308 }
309
310 if len(splitted) == 1 {
311 return splitted[0], splitted[0], nil
312 }
313
314 if splitted[0] == "" {
315 splitted[0] = "."
316 }
317 if splitted[1] == "" {
318 splitted[1] = "."
319 }
320 return splitted[0], splitted[1], nil
321}
322
323func (c *controller) initClient(ctx devspacecontext.Context, pod *v1.Pod, arch, container string, syncConfig *latest.SyncConfig, starter sync.DelayedContainerStarter, verbose bool, customLog logpkg.Logger) (*sync.Sync, error) {
324 localPath, containerPath, err := ParseSyncPath(syncConfig.Path)

Callers 4

fromSyncConfigFunction · 0.92
startSyncMethod · 0.85
initClientMethod · 0.85
TestParseSyncPathFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseSyncPathFunction · 0.68