MCPcopy Create free account
hub / github.com/diillson/chatcli / contextCreateOrUpdateSuggestions

Method contextCreateOrUpdateSuggestions

cli/cli_completer.go:703–724  ·  view source on GitHub ↗

contextCreateOrUpdateSuggestions covers the flag-heavy create/update verbs.

(
	sub string, args []string, line string, d prompt.Document,
)

Source from the content-addressed store, hash-verified

701
702// contextCreateOrUpdateSuggestions covers the flag-heavy create/update verbs.
703func (cli *ChatCLI) contextCreateOrUpdateSuggestions(
704 sub string, args []string, line string, d prompt.Document,
705) []prompt.Suggest {
706 word := d.GetWordBeforeCursor()
707 if strings.HasPrefix(word, "-") {
708 return contextCreateUpdateFlagSuggestions()
709 }
710 if out, matched := contextFlagValueSuggestions(args, line); matched {
711 return out
712 }
713 if sub == "create" && len(args) == 2 {
714 return []prompt.Suggest{{Text: "", Description: i18n.T("complete.context.prompt_name")}}
715 }
716 endsWithSpace := strings.HasSuffix(line, " ")
717 if sub == "update" && (len(args) == 2 || (len(args) == 3 && !endsWithSpace)) {
718 return cli.getContextNameSuggestions()
719 }
720 if len(args) >= 3 {
721 return cli.filePathCompleter(word)
722 }
723 return []prompt.Suggest{}
724}
725
726// contextFlagValueSuggestions returns value suggestions for flags whose
727// position is immediately after `--mode`/`-m` (mode list), or signals that

Calls 5

filePathCompleterMethod · 0.95
TFunction · 0.92