package cmd import ( "fmt" "log" "os" "path/filepath" "github.com/spf13/cobra" ) var historyCmd = &cobra.Command{ Use: "history", Short: "show command history", Long: "Shows history of the last 2000 commands", Run: func(cmd *cobra.Command, args []string) { dirname, err := os.UserConfigDir() if err != nil { log.Printf("error getting user config dir: %v\n", err) } historyFile := filepath.Join(dirname, "sst", "sst_history") content, err := os.ReadFile(historyFile) if err != nil { fmt.Println("error reading history: ", err) return } fmt.Println(string(content)) }, }