From eb43d4513c19163ea2fe6ce825c6017f403b18c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A0=CF=85=CE=B1=CE=B7=20=D7=A0=CF=85=CE=B1=CE=B7=D1=95?= =?UTF-8?q?=CF=83=CE=B7?= Date: Sun, 15 Mar 2026 22:07:25 -0700 Subject: [PATCH] fix: skip config loading for version command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add skipConfigCmds set so commands like version can run without a config file present. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- cmd/root.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index c16286fe9..2f20922c0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -45,6 +45,9 @@ var ( appFs = afero.NewOsFs() logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) jsonOutput bool + + // skipConfigCmds lists subcommands that don't need a config file. + skipConfigCmds = map[string]bool{"version": true} ) // rootCmd represents the base command when called without any subcommands. @@ -96,6 +99,11 @@ func init() { } func initConfig() { + // Commands that don't need a config file. + if len(os.Args) > 1 && skipConfigCmds[os.Args[1]] { + return + } + viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) viper.SetConfigType("yaml")