chore(lockfile) change flag to --lockfile

This is more consistent with the `lockfile` config option
This commit is contained in:
Boris Bera
2024-12-01 14:53:25 -05:00
parent de0862a3dd
commit 59b2393127
6 changed files with 17 additions and 17 deletions

View File

@@ -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
)

View File

@@ -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
}

View File

@@ -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()