Fix skip setup for some general cli commands (#3498)

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
This commit is contained in:
Anbraten 2024-03-18 13:08:05 +01:00 committed by GitHub
parent 2268c0c2ae
commit b6b2ab0901
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"os"
"slices"
"github.com/adrg/xdg"
"github.com/rs/zerolog/log"
@ -17,9 +18,10 @@ type Config struct {
LogLevel string `json:"log_level"`
}
var skipSetupForCommands = []string{"setup", "help", "h", "version", "update", "lint", ""}
func Load(c *cli.Context) error {
// If the command is setup, we don't need to load the config
if firstArg := c.Args().First(); firstArg == "setup" {
if firstArg := c.Args().First(); slices.Contains(skipSetupForCommands, firstArg) {
return nil
}