From b93ee942334ab544a0bcf52df9442cbd091dd845 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Wed, 3 Jan 2024 17:45:02 +0000 Subject: [PATCH] Rename `lsCmd` to `listCmd`, add `ls` as an alias --- pkg/cli/cmd.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/cli/cmd.go b/pkg/cli/cmd.go index fba94ea..5174c63 100644 --- a/pkg/cli/cmd.go +++ b/pkg/cli/cmd.go @@ -18,7 +18,7 @@ var ( ) const ( - // Limit to number of conversations shown with `ls`, without --all + // Limit number of conversations shown with `ls`, without --all LS_LIMIT int = 25 ) @@ -32,14 +32,14 @@ func init() { cmd.MarkFlagsMutuallyExclusive("system-prompt", "system-prompt-file") } - lsCmd.Flags().Bool("all", false, fmt.Sprintf("Show all conversations, by default only the last %d are shown", LS_LIMIT)) + listCmd.Flags().Bool("all", false, fmt.Sprintf("Show all conversations, by default only the last %d are shown", LS_LIMIT)) renameCmd.Flags().Bool("generate", false, "Generate a conversation title") rootCmd.AddCommand( cloneCmd, continueCmd, editCmd, - lsCmd, + listCmd, newCmd, promptCmd, renameCmd, @@ -114,8 +114,7 @@ func lookupConversationE(shortName string) (*Conversation, error) { } // handleConversationReply handles sending messages to an existing -// conversation, optionally persisting them. It displays the entire -// conversation before +// conversation, optionally persisting both the sent replies and responses. func handleConversationReply(c *Conversation, persist bool, toSend ...Message) { existing, err := store.Messages(c) if err != nil { @@ -182,14 +181,15 @@ var rootCmd = &cobra.Command{ }, } -var lsCmd = &cobra.Command{ - Use: "ls", +var listCmd = &cobra.Command{ + Use: "list", + Aliases: []string{"ls"}, Short: "List conversations", Long: `List conversations in order of recent activity`, Run: func(cmd *cobra.Command, args []string) { conversations, err := store.Conversations() if err != nil { - fmt.Println("Could not fetch conversations.") + Fatal("Could not fetch conversations.\n") return }