Fixed variable shadowing bug in ls command

This commit is contained in:
Matt Low 2024-02-22 05:00:03 +00:00
parent fa966d30db
commit 120e61e88b

View File

@ -258,17 +258,17 @@ var listCmd = &cobra.Command{
var conversationsPrinted int var conversationsPrinted int
outer: outer:
for _, category := range categories { for _, category := range categories {
conversations, ok := categorized[category.name] conversationLines, ok := categorized[category.name]
if !ok { if !ok {
continue continue
} }
slices.SortFunc(conversations, func(a, b ConversationLine) int { slices.SortFunc(conversationLines, func(a, b ConversationLine) int {
return int(a.timeSinceReply - b.timeSinceReply) return int(a.timeSinceReply - b.timeSinceReply)
}) })
fmt.Printf("%s:\n", category.name) fmt.Printf("%s:\n", category.name)
for _, conv := range conversations { for _, conv := range conversationLines {
if conversationsPrinted >= LS_LIMIT && !all { if conversationsPrinted >= LS_LIMIT && !all {
fmt.Printf("%d remaining message(s), use --all to view.\n", len(conversations)-conversationsPrinted) fmt.Printf("%d remaining message(s), use --all to view.\n", len(conversations)-conversationsPrinted)
break outer break outer