Rename lsCmd
to listCmd
, add ls
as an alias
This commit is contained in:
parent
db788760a3
commit
b93ee94233
@ -18,7 +18,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Limit to number of conversations shown with `ls`, without --all
|
// Limit number of conversations shown with `ls`, without --all
|
||||||
LS_LIMIT int = 25
|
LS_LIMIT int = 25
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,14 +32,14 @@ func init() {
|
|||||||
cmd.MarkFlagsMutuallyExclusive("system-prompt", "system-prompt-file")
|
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")
|
renameCmd.Flags().Bool("generate", false, "Generate a conversation title")
|
||||||
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
cloneCmd,
|
cloneCmd,
|
||||||
continueCmd,
|
continueCmd,
|
||||||
editCmd,
|
editCmd,
|
||||||
lsCmd,
|
listCmd,
|
||||||
newCmd,
|
newCmd,
|
||||||
promptCmd,
|
promptCmd,
|
||||||
renameCmd,
|
renameCmd,
|
||||||
@ -114,8 +114,7 @@ func lookupConversationE(shortName string) (*Conversation, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handleConversationReply handles sending messages to an existing
|
// handleConversationReply handles sending messages to an existing
|
||||||
// conversation, optionally persisting them. It displays the entire
|
// conversation, optionally persisting both the sent replies and responses.
|
||||||
// conversation before
|
|
||||||
func handleConversationReply(c *Conversation, persist bool, toSend ...Message) {
|
func handleConversationReply(c *Conversation, persist bool, toSend ...Message) {
|
||||||
existing, err := store.Messages(c)
|
existing, err := store.Messages(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -182,14 +181,15 @@ var rootCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var lsCmd = &cobra.Command{
|
var listCmd = &cobra.Command{
|
||||||
Use: "ls",
|
Use: "list",
|
||||||
|
Aliases: []string{"ls"},
|
||||||
Short: "List conversations",
|
Short: "List conversations",
|
||||||
Long: `List conversations in order of recent activity`,
|
Long: `List conversations in order of recent activity`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
conversations, err := store.Conversations()
|
conversations, err := store.Conversations()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Could not fetch conversations.")
|
Fatal("Could not fetch conversations.\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user