Skip to content

Commit

Permalink
fix: allow to run --settings with an invalid yaml configuration (#225)
Browse files Browse the repository at this point in the history
closes #220
closes #222
  • Loading branch information
caarlos0 committed Mar 1, 2024
1 parent 9ed50d9 commit 11dbf2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"runtime/debug"
"slices"
"strings"

timeago "github.com/caarlos0/timea.go"
Expand Down Expand Up @@ -276,7 +277,11 @@ func main() {
config, err = ensureConfig()
if err != nil {
handleError(modsError{err, "Could not load your configuration file."})
os.Exit(1)
// if user is editing the settings, only print out the error, but do
// not exit.
if !slices.Contains(os.Args, "--settings") {
os.Exit(1)
}
}

cache = newCache(config.CachePath)
Expand Down

0 comments on commit 11dbf2d

Please sign in to comment.