Yeah, I kinda gave up, i will fix it later or something I recon
This commit is contained in:
+8
-1
@@ -2,6 +2,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -14,9 +16,14 @@ var rootCmd = &cobra.Command{
|
||||
Long: `Allows the configuration and communication with the dashDisplay`,
|
||||
}
|
||||
|
||||
type loggerKey struct{}
|
||||
|
||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
||||
func Execute() {
|
||||
func Execute(log *slog.Logger) {
|
||||
ctx := context.WithValue(context.Background(), loggerKey{}, log)
|
||||
rootCmd.SetContext(ctx)
|
||||
|
||||
err := rootCmd.Execute()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user