package chatlog import ( "github.com/sjzar/chatlog/internal/chatlog" "github.com/rs/zerolog/log" "github.com/spf13/cobra" ) func init() { // windows only cobra.MousetrapHelpText = "" rootCmd.PersistentFlags().BoolVar(&Debug, "debug", false, "debug") rootCmd.PersistentPreRun = initLog } func Execute() { if err := rootCmd.Execute(); err != nil { log.Err(err).Msg("command execution failed") } } var rootCmd = &cobra.Command{ Use: "chatlog", Short: "chatlog", Long: `chatlog`, Example: `chatlog`, Args: cobra.MinimumNArgs(0), CompletionOptions: cobra.CompletionOptions{ HiddenDefaultCmd: true, }, PreRun: initTuiLog, Run: Root, } func Root(cmd *cobra.Command, args []string) { m := chatlog.New() if err := m.Run(""); err != nil { log.Err(err).Msg("failed to run chatlog instance") } }