-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.go
31 lines (27 loc) · 699 Bytes
/
args.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 "strings"
func splitRemotePath(args []string) (string, string) {
// Splits requated remote-path string and parses into chunks
var requestedRemote, userPath string
if strings.Contains(args[0], ":") {
// remote with path provided
chunks := strings.Split(args[0], ":")
requestedRemote = chunks[0]
userPath = chunks[1]
} else {
// only remote name provded
requestedRemote = args[0]
userPath = "/"
}
return requestedRemote, userPath
}
func getSyncDirection(args []string) string {
// if no direction specified, assume "up"
var direction string
if len(args) > 1 && args[1] == "down" {
direction = "down"
} else {
direction = "up"
}
return direction
}