57 lines
979 B
Go
57 lines
979 B
Go
|
package settings
|
||
|
|
||
|
import (
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
"velvettear/gosync/log"
|
||
|
)
|
||
|
|
||
|
// exported variable(s)
|
||
|
var Verbose bool
|
||
|
var Source string
|
||
|
var Target string
|
||
|
var Concurrency int
|
||
|
var Password string
|
||
|
var User string
|
||
|
|
||
|
// exported function(s)
|
||
|
func TargetIsRemote() bool {
|
||
|
return strings.Contains(Target, ":")
|
||
|
}
|
||
|
|
||
|
// unexported function(s)
|
||
|
func setVerbose(verbose bool) {
|
||
|
Verbose = verbose
|
||
|
if Verbose {
|
||
|
log.SetLogLevel(0)
|
||
|
} else {
|
||
|
log.SetLogLevel(1)
|
||
|
}
|
||
|
log.Debug("set verbose flag", strconv.FormatBool(Verbose))
|
||
|
}
|
||
|
|
||
|
func setSource(source string) {
|
||
|
Source = source
|
||
|
log.Debug("set source", Source)
|
||
|
}
|
||
|
|
||
|
func setTarget(target string) {
|
||
|
Target = target
|
||
|
log.Debug("set target", Target)
|
||
|
}
|
||
|
|
||
|
func setConcurrency(concurrency int) {
|
||
|
Concurrency = concurrency
|
||
|
log.Debug("set concurrency", strconv.Itoa(Concurrency))
|
||
|
}
|
||
|
|
||
|
func setPassword(password string) {
|
||
|
Password = password
|
||
|
log.Debug("set password", Password)
|
||
|
}
|
||
|
|
||
|
func setUser(user string) {
|
||
|
User = user
|
||
|
log.Debug("set user", User)
|
||
|
}
|