package main import ( "fmt" "go.wit.com/lib/protobuf/chatpb" "go.wit.com/log" ) func doPlayback() { if argv.Playback.Uuid != "" { showChat(argv.Playback.Uuid) return } listChats(me.chats) } func showChat(uuid string) { chat := me.chats.FindByUuid(uuid) if chat == nil { log.Info("unknown uuid", uuid) return } // Call the new, dedicated formatting function. prettyFormatChat(chat) } func listChats(chats *chatpb.Chats) { log.Infof("Found %d chat topic(s) in the log.", len(chats.GetChats())) fmt.Println("-------------------------------------------------") for _, chat := range chats.GetChats() { entryCount := len(chat.GetEntries()) var formattedTime string if ctime := chat.GetCtime(); ctime != nil { t := ctime.AsTime() formattedTime = t.Format("2006-01-02 15:04:05") } else { formattedTime = "No Timestamp" } fmt.Printf("Topic: %-25s | Entries: %-4d | Started: %s | UUID: %s\n", chat.GetChatName(), entryCount, formattedTime, chat.GetUuid(), ) } fmt.Println("-------------------------------------------------") }