ValidArgsGetControls returns autocomplete suggestions for selecting a control. Since a control identified by a composite key of catalog, category and control name, first a list of catalogs and categories is returned, then a control to select.
(_ *cobra.Command, args []string, toComplete string)
| 279 | // control name, first a list of catalogs and categories is returned, then a |
| 280 | // control to select. |
| 281 | func ValidArgsGetControls(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 282 | if len(args) == 0 { |
| 283 | return getCatalogs(toComplete), cobra.ShellCompDirectiveNoFileComp |
| 284 | } else if len(args) == 1 { |
| 285 | return getCategories(args[0], toComplete), cobra.ShellCompDirectiveNoFileComp |
| 286 | } else if len(args) == 2 { |
| 287 | return getControls(args[0], args[1], toComplete), cobra.ShellCompDirectiveNoFileComp |
| 288 | } else { |
| 289 | return []string{}, cobra.ShellCompDirectiveNoFileComp |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | func ValidArgsGetCertificationTargets(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 294 | return getCertificationTargets(toComplete), cobra.ShellCompDirectiveNoFileComp |