MCPcopy Create free account
hub / github.com/algolia/cli / IndexNames

Function IndexNames

pkg/cmdutil/valid_args.go:12–31  ·  view source on GitHub ↗

IndexNames returns a function to list the index names from the given search client.

(
	clientF func() (*search.APIClient, error),
)

Source from the content-addressed store, hash-verified

10
11// IndexNames returns a function to list the index names from the given search client.
12func IndexNames(
13 clientF func() (*search.APIClient, error),
14) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
15 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
16 client, err := clientF()
17 if err != nil {
18 return nil, cobra.ShellCompDirectiveError
19 }
20 res, err := client.ListIndices(client.NewApiListIndicesRequest())
21 if err != nil {
22 return nil, cobra.ShellCompDirectiveError
23 }
24
25 names := make([]string, 0, len(res.Items))
26 for _, index := range res.Items {
27 names = append(names, index.Name)
28 }
29 return names, cobra.ShellCompDirectiveNoFileComp
30 }
31}
32
33// CrawlerIDs returns a function to list the crawler IDs from the given crawler client.
34func CrawlerIDs(

Callers 15

NewImportCmdFunction · 0.92
NewDeleteCmdFunction · 0.92
NewBrowseCmdFunction · 0.92
NewUpdateCmdFunction · 0.92
NewSearchCmdFunction · 0.92
NewImportCmdFunction · 0.92
NewDeleteCmdFunction · 0.92
NewSaveCmdFunction · 0.92
NewBrowseCmdFunction · 0.92
NewGetCmdFunction · 0.92
NewImportCmdFunction · 0.92
NewSetCmdFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected