Revert "feat(playback): Implement listEntries for chat summary"
This reverts commit af9bc2db8c
.
This commit is contained in:
parent
af9bc2db8c
commit
d0c27606a3
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/chatpb"
|
"go.wit.com/lib/protobuf/chatpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -23,8 +22,8 @@ func showChat(uuid string) {
|
||||||
log.Info("unknown uuid", uuid)
|
log.Info("unknown uuid", uuid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Call the new listEntries function for a summary view.
|
// Call the new, dedicated formatting function.
|
||||||
listEntries(chat)
|
prettyFormatChat(chat)
|
||||||
}
|
}
|
||||||
|
|
||||||
func listChats(chats *chatpb.Chats) {
|
func listChats(chats *chatpb.Chats) {
|
||||||
|
@ -47,37 +46,13 @@ func listChats(chats *chatpb.Chats) {
|
||||||
formattedTime,
|
formattedTime,
|
||||||
chat.GetUuid(),
|
chat.GetUuid(),
|
||||||
)
|
)
|
||||||
|
if argv.Playback.Long != nil {
|
||||||
|
listEntries(chat)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("-------------------------------------------------")
|
fmt.Println("-------------------------------------------------")
|
||||||
}
|
}
|
||||||
|
|
||||||
// print out one line for each chat entry
|
// print out one line for each chat entry
|
||||||
func listEntries(chat *chatpb.Chat) {
|
func listEntries(chat *chatpb.Chat) {
|
||||||
fmt.Printf("\n--- Entries for Topic: %s ---\%n", chat.GetChatName())
|
|
||||||
for i, entry := range chat.GetEntries() {
|
|
||||||
author := entry.GetFrom().String()
|
|
||||||
var formattedTime string
|
|
||||||
if ctime := entry.GetCtime(); ctime != nil {
|
|
||||||
t := ctime.AsTime()
|
|
||||||
formattedTime = t.Format("15:04:05") // Just the time for entry summary
|
|
||||||
} else {
|
|
||||||
formattedTime = "No Time"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a short preview of the content
|
|
||||||
contentPreview := strings.TrimSpace(entry.GetContent())
|
|
||||||
if len(contentPreview) > 60 {
|
|
||||||
contentPreview = contentPreview[:57] + "..."
|
|
||||||
}
|
|
||||||
// Replace newlines with spaces for a clean one-line view
|
|
||||||
contentPreview = strings.ReplaceAll(contentPreview, "\n", " ")
|
|
||||||
|
|
||||||
fmt.Printf(" %%2d. [%%s] (%%s): %%s\n",
|
|
||||||
i+1,
|
|
||||||
author,
|
|
||||||
formattedTime,
|
|
||||||
contentPreview,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
fmt.Println("-------------------------------------------------")
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue