MCPcopy Create free account
hub / github.com/clouditor/clouditor / ValidArgsGetControls

Function ValidArgsGetControls

cli/session.go:281–291  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

279// control name, first a list of catalogs and categories is returned, then a
280// control to select.
281func 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
293func ValidArgsGetCertificationTargets(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
294 return getCertificationTargets(toComplete), cobra.ShellCompDirectiveNoFileComp

Callers 1

TestValidArgsGetControlsFunction · 0.92

Calls 3

getCatalogsFunction · 0.85
getCategoriesFunction · 0.85
getControlsFunction · 0.85

Tested by 1

TestValidArgsGetControlsFunction · 0.74