diff --git a/app/cli/cmd/root.go b/app/cli/cmd/root.go index 05a10d0c5..45c53d2ab 100644 --- a/app/cli/cmd/root.go +++ b/app/cli/cmd/root.go @@ -72,8 +72,7 @@ var telemetryWg sync.WaitGroup // Environment variable prefix for vipers const envPrefix = "CHAINLOOP" -func Execute(l zerolog.Logger) error { - rootCmd := NewRootCmd(l) +func Execute(rootCmd *cobra.Command) error { if err := rootCmd.Execute(); err != nil { // The local file is pointing to the wrong organization, we remove it if v1.IsUserNotMemberOfOrgErrorNotInOrg(err) { diff --git a/app/cli/main.go b/app/cli/main.go index ca1b95407..bbaf98712 100644 --- a/app/cli/main.go +++ b/app/cli/main.go @@ -1,5 +1,5 @@ // -// Copyright 2023 The Chainloop Authors. +// Copyright 2023-2025 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,9 +34,9 @@ import ( func main() { // Couldn't find an easier way to disable the timestamp logger := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr, FormatTimestamp: func(interface{}) string { return "" }}) - + rootCmd := cmd.NewRootCmd(logger) // Run the command - if err := cmd.Execute(logger); err != nil { + if err := cmd.Execute(rootCmd); err != nil { msg, exitCode := errorInfo(err, logger) logger.Error().Msg(msg) os.Exit(exitCode)