dedupe/settings/variables.go

49 lines
1.1 KiB
Go
Raw Normal View History

2023-08-11 13:34:54 +02:00
package settings
import (
2023-08-15 14:51:54 +02:00
"os"
2023-08-11 13:34:54 +02:00
"strconv"
"velvettear/dedupe/log"
)
// exported variable(s)
var Verbose bool
var Delete bool
var SourceDirectory string
var ComparisonDirectory string
2023-08-15 14:51:54 +02:00
var MoveDirectory string
2023-08-11 13:34:54 +02:00
// unexported function(s)
func setVerbose(verbose bool) {
Verbose = verbose
log.SetLogLevel(0)
log.Debug("set verbose flag", strconv.FormatBool(Verbose))
}
func setDelete(delete bool) {
Delete = delete
log.Debug("set delete flag", strconv.FormatBool(Delete))
}
func setSourceDirectory(directory string) {
SourceDirectory = directory
log.Debug("set source directory", SourceDirectory)
}
func setComparisonDirectory(directory string) {
ComparisonDirectory = directory
log.Debug("set source directory", ComparisonDirectory)
}
2023-08-15 14:51:54 +02:00
func setMoveDirectory(directory string) {
stats, error := os.Stat(directory)
if error != nil && os.IsNotExist(error) {
log.Fatal("given move directory '"+directory+"' does not exist", error.Error())
}
if !stats.IsDir() {
log.Fatal("given move directory '" + directory + "' is not a valid directory")
}
MoveDirectory = directory
log.Debug("set move directory", MoveDirectory)
}