(itemType string, args []string, toComplete string, cfg csconfig.Getter)
| 106 | } |
| 107 | |
| 108 | func compAllItems(itemType string, args []string, toComplete string, cfg csconfig.Getter) ([]string, cobra.ShellCompDirective) { |
| 109 | hub, err := require.Hub(cfg(), nil) |
| 110 | if err != nil { |
| 111 | return nil, cobra.ShellCompDirectiveDefault |
| 112 | } |
| 113 | |
| 114 | comp := make([]string, 0) |
| 115 | |
| 116 | for _, item := range hub.GetItemsByType(itemType, false) { |
| 117 | if !slices.Contains(args, item.Name) && strings.Contains(item.Name, toComplete) { |
| 118 | comp = append(comp, item.Name) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | cobra.CompDebugln(fmt.Sprintf("%s: %+v", itemType, comp), true) |
| 123 | |
| 124 | return comp, cobra.ShellCompDirectiveNoFileComp |
| 125 | } |
| 126 | |
| 127 | func (cli *cliItem) newInstallCmd() *cobra.Command { |
| 128 | var ( |
no test coverage detected
searching dependent graphs…