From 26116631685e88e306a69c3dc998f85862e199b8 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Thu, 22 Feb 2024 05:02:08 +0000 Subject: [PATCH] Add --count flag to list command, lower default from 25 to 5 --- pkg/cli/cmd.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/cli/cmd.go b/pkg/cli/cmd.go index d628d0a..de00a46 100644 --- a/pkg/cli/cmd.go +++ b/pkg/cli/cmd.go @@ -19,7 +19,7 @@ var ( const ( // Limit number of conversations shown with `ls`, without --all - LS_LIMIT int = 25 + LS_LIMIT int = 5 ) func init() { @@ -32,7 +32,9 @@ func init() { cmd.MarkFlagsMutuallyExclusive("system-prompt", "system-prompt-file") } - listCmd.Flags().Bool("all", false, fmt.Sprintf("Show all conversations, by default only the last %d are shown", LS_LIMIT)) + listCmd.Flags().Int("count", LS_LIMIT, fmt.Sprintf("Number of conversations to list")) + listCmd.Flags().Bool("all", false, "List all conversations") + renameCmd.Flags().Bool("generate", false, "Generate a conversation title") editCmd.Flags().Int("offset", 1, "Offset from the last reply to edit (Default: edit your last message, assuming there's an assistant reply)") @@ -225,6 +227,7 @@ var listCmd = &cobra.Command{ categorized := map[string][]ConversationLine{} all, _ := cmd.Flags().GetBool("all") + count, _ := cmd.Flags().GetInt("count") for _, conversation := range conversations { lastMessage, err := store.LastMessage(&conversation) @@ -269,7 +272,7 @@ var listCmd = &cobra.Command{ fmt.Printf("%s:\n", category.name) for _, conv := range conversationLines { - if conversationsPrinted >= LS_LIMIT && !all { + if conversationsPrinted >= count && !all { fmt.Printf("%d remaining message(s), use --all to view.\n", len(conversations)-conversationsPrinted) break outer }