MCPcopy Create free account
hub / github.com/github/gh-aw / CompleteEngineNames

Function CompleteEngineNames

pkg/cli/completions.go:102–113  ·  view source on GitHub ↗

CompleteEngineNames provides shell completion for engine names (--engine flag)

(cmd *cobra.Command, args []string, toComplete string)

Source from the content-addressed store, hash-verified

100
101// CompleteEngineNames provides shell completion for engine names (--engine flag)
102func CompleteEngineNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
103 completionsLog.Printf("Completing engine names with prefix: %s", toComplete)
104
105 engines := ValidEngineNames()
106
107 filtered := sliceutil.Filter(engines, func(engine string) bool {
108 return toComplete == "" || strings.HasPrefix(engine, toComplete)
109 })
110
111 completionsLog.Printf("Found %d matching engines", len(filtered))
112 return filtered, cobra.ShellCompDirectiveNoFileComp
113}
114
115// CompleteDirectories provides shell completion for directory paths
116func CompleteDirectories(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {

Calls 3

FilterFunction · 0.92
ValidEngineNamesFunction · 0.85
PrintfMethod · 0.45