// The cmd package is the main package where all the main hooks and methods are called. // GoSally uses spf13/cobra to organize all the calls. package cmd import ( "fmt" "log" "os" "github.com/akyaiy/GoSally-mvp/hooks" "github.com/akyaiy/GoSally-mvp/internal/colors" "github.com/akyaiy/GoSally-mvp/internal/core/corestate" "github.com/spf13/cobra" ) var rootCmd = &cobra.Command{ Use: "node", Short: "Go Sally node", Long: ` GoSally is an http server that handles jsonrpc-2.0 requests by calling methods as lua scripts in a given directory. For more information, visit: https://gosally.oblat.lv/`, Run: func(cmd *cobra.Command, args []string) { _ = cmd.Help() }, } // Execute prepares global log, loads cmdline args // and executes rootCmd.Execute() func Execute() { log.SetOutput(os.Stdout) log.SetPrefix(colors.SetBrightBlack(fmt.Sprintf("(%s) ", corestate.StageNotReady))) log.SetFlags(log.Ldate | log.Ltime) hooks.Compositor.LoadCMDLine(rootCmd) _ = rootCmd.Execute() // if err := rootCmd.Execute(); err != nil { // log.Fatalf("Unexpected error: %s", err.Error()) // } }