(itemType string, _ []string, toComplete string, cfg csconfig.Getter)
| 110 | } |
| 111 | |
| 112 | func compInstalledItems(itemType string, _ []string, toComplete string, cfg csconfig.Getter) ([]string, cobra.ShellCompDirective) { |
| 113 | hub, err := require.Hub(cfg(), nil) |
| 114 | if err != nil { |
| 115 | return nil, cobra.ShellCompDirectiveDefault |
| 116 | } |
| 117 | |
| 118 | items := hub.GetInstalledByType(itemType, true) |
| 119 | |
| 120 | comp := make([]string, 0) |
| 121 | |
| 122 | for _, item := range items { |
| 123 | if strings.Contains(item.Name, toComplete) { |
| 124 | comp = append(comp, item.Name) |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | cobra.CompDebugln(fmt.Sprintf("%s: %+v", itemType, comp), true) |
| 129 | |
| 130 | return comp, cobra.ShellCompDirectiveNoFileComp |
| 131 | } |
no test coverage detected
searching dependent graphs…