mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-09-08 03:20:39 +00:00
chore(lockfile) change flag to --lockfile
This is more consistent with the `lockfile` config option
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package flags
|
||||
|
||||
var (
|
||||
CI bool = false
|
||||
VERBOSE bool = false
|
||||
CRON_LEAN bool = false
|
||||
RESTIC_BIN string
|
||||
DOCKER_IMAGE string
|
||||
LOCKFILE_PATH string
|
||||
CI bool = false
|
||||
VERBOSE bool = false
|
||||
CRON_LEAN bool = false
|
||||
RESTIC_BIN string
|
||||
DOCKER_IMAGE string
|
||||
LOCKFILE string
|
||||
)
|
||||
|
@@ -20,14 +20,14 @@ const (
|
||||
)
|
||||
|
||||
// getLockfilePath returns the path to the lockfile. The path for the lockfile
|
||||
// can be sources from multiple places If flags.LOCKFILE_PATH is set, its value
|
||||
// is used; if the config has the `lockfile` option set, its value is used;
|
||||
// can be sources from multiple places If flags.LOCKFILE is set, its value is
|
||||
// used; if the config has the `lockfile` option set, its value is used;
|
||||
// otherwise the path is generated relative to the config file.
|
||||
func getLockfilePath() string {
|
||||
if flags.LOCKFILE_PATH != "" {
|
||||
abs, err := filepath.Abs(flags.LOCKFILE_PATH)
|
||||
if flags.LOCKFILE != "" {
|
||||
abs, err := filepath.Abs(flags.LOCKFILE)
|
||||
if err != nil {
|
||||
return flags.LOCKFILE_PATH
|
||||
return flags.LOCKFILE
|
||||
}
|
||||
return abs
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ import (
|
||||
func setup(t *testing.T) {
|
||||
t.Helper()
|
||||
cleanup := func() {
|
||||
flags.LOCKFILE_PATH = ""
|
||||
flags.LOCKFILE = ""
|
||||
config = nil
|
||||
once = sync.Once{}
|
||||
viper.Reset()
|
||||
@@ -62,7 +62,7 @@ func TestGetLockfilePath(t *testing.T) {
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
setup(t)
|
||||
flags.LOCKFILE_PATH = testCase.flag
|
||||
flags.LOCKFILE = testCase.flag
|
||||
if testCase.config != "" {
|
||||
viper.Set("lockfile", testCase.config)
|
||||
err := viper.WriteConfig()
|
||||
|
Reference in New Issue
Block a user