CompleteEngineNames provides shell completion for engine names (--engine flag)
(cmd *cobra.Command, args []string, toComplete string)
| 100 | |
| 101 | // CompleteEngineNames provides shell completion for engine names (--engine flag) |
| 102 | func 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 |
| 116 | func CompleteDirectories(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |