From b6b2ab09012c8eacd1544c4c52f1363f39b3c917 Mon Sep 17 00:00:00 2001 From: Anbraten <6918444+anbraten@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:08:05 +0100 Subject: [PATCH] Fix skip setup for some general cli commands (#3498) Co-authored-by: Robert Kaussow --- cli/internal/config/config.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/internal/config/config.go b/cli/internal/config/config.go index 32a047250..467ee1cfc 100644 --- a/cli/internal/config/config.go +++ b/cli/internal/config/config.go @@ -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 }