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

Method completeSystemCommands

cli/cli_completer.go:532–557  ·  view source on GitHub ↗

completeSystemCommands autocompleta comandos do sistema

(prefix string)

Source from the content-addressed store, hash-verified

530
531// completeSystemCommands autocompleta comandos do sistema
532func (cli *ChatCLI) completeSystemCommands(prefix string) []string {
533 var completions []string
534
535 // Obter o PATH do sistema
536 pathEnv := os.Getenv("PATH")
537 paths := strings.Split(pathEnv, string(os.PathListSeparator))
538
539 seen := make(map[string]bool)
540
541 for _, pathDir := range paths {
542 files, err := os.ReadDir(pathDir)
543 if err != nil {
544 continue
545 }
546
547 for _, file := range files {
548 name := file.Name()
549 if strings.HasPrefix(name, prefix) && !seen[name] {
550 seen[name] = true
551 completions = append(completions, name)
552 }
553 }
554 }
555
556 return completions
557}
558
559// getContextSuggestions - Sugestões melhoradas para /context
560// contextSubcommands is the static list of `/context <sub>` verbs.

Callers 1

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected