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

Function ValidArgsGetCategory

cli/session.go:267–275  ·  view source on GitHub ↗

ValidArgsGetCategory returns autocomplete suggestions for selecting a category. Since a category identified by a composite key of catalog and category name, first a list of catalogs is returned, then a category to select.

(_ *cobra.Command, args []string, toComplete string)

Source from the content-addressed store, hash-verified

265// category. Since a category identified by a composite key of catalog and
266// category name, first a list of catalogs is returned, then a category to select.
267func ValidArgsGetCategory(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
268 if len(args) == 0 {
269 return getCatalogs(toComplete), cobra.ShellCompDirectiveNoFileComp
270 } else if len(args) == 1 {
271 return getCategories(args[0], toComplete), cobra.ShellCompDirectiveNoFileComp
272 } else {
273 return []string{}, cobra.ShellCompDirectiveNoFileComp
274 }
275}
276
277// ValidArgsGetControls returns autocomplete suggestions for selecting a control.
278// Since a control identified by a composite key of catalog, category and

Callers 1

TestValidArgsGetCategoryFunction · 0.92

Calls 2

getCatalogsFunction · 0.85
getCategoriesFunction · 0.85

Tested by 1

TestValidArgsGetCategoryFunction · 0.74