-
Notifications
You must be signed in to change notification settings - Fork 0
/
targets.go
31 lines (23 loc) · 811 Bytes
/
targets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"fmt"
"path/filepath"
)
func getLocalRcTarget(config Config, remote Remote, userPath string) string {
var localTarget string
//localPath specified
if (&remote.LocalPath != nil) && (remote.LocalPath != "") {
localTarget = fmt.Sprintf("%s/%s/%s/", config.BaseDir, remote.LocalPath, userPath)
} else {
localTarget = fmt.Sprintf("%s/%s/%s/%s/", config.BaseDir, remote.Remote, remote.RemotePath, userPath)
}
localTarget = filepath.Clean(localTarget)
return localTarget
}
func getRemoteRcTarget(config Config, remote Remote, userPath string) string {
var remoteTarget, localPath string
localPath = fmt.Sprintf("%s/%s", remote.RemotePath, userPath)
localPath = filepath.Clean(localPath)
remoteTarget = fmt.Sprintf("%s:%s", remote.Remote, localPath)
return remoteTarget
}