Rename `lsCmd` to `listCmd`, add `ls` as an alias

This commit is contained in:
Matt Low 2024-01-03 17:45:02 +00:00
parent db788760a3
commit b93ee94233
1 changed files with 8 additions and 8 deletions

View File

@ -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
}