Fixed lmcli view
completions
- Don't return completions if an arg is already present - Fixed typo in method name
This commit is contained in:
parent
4e3976fc73
commit
b0e4739f4f
@ -140,7 +140,11 @@ var viewCmd = &cobra.Command{
|
|||||||
fmt.Println()
|
fmt.Println()
|
||||||
},
|
},
|
||||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
return store.ConverstionShortNameCompletions(toComplete), cobra.ShellCompDirectiveNoFileComp
|
compMode := cobra.ShellCompDirectiveNoFileComp
|
||||||
|
if len(args) != 0 {
|
||||||
|
return nil, compMode
|
||||||
|
}
|
||||||
|
return store.ConversationShortNameCompletions(toComplete), compMode
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func (s *Store) Conversations() ([]Conversation, error) {
|
|||||||
return conversations, err
|
return conversations, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Store) ConverstionShortNameCompletions(shortName string) []string {
|
func (s *Store) ConversationShortNameCompletions(shortName string) []string {
|
||||||
var completions []string
|
var completions []string
|
||||||
conversations, _ := s.Conversations() // ignore error for completions
|
conversations, _ := s.Conversations() // ignore error for completions
|
||||||
for _, conversation := range conversations {
|
for _, conversation := range conversations {
|
||||||
|
Loading…
Reference in New Issue
Block a user