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

Function CrawlerIDs

pkg/cmdutil/valid_args.go:34–53  ·  view source on GitHub ↗

CrawlerIDs returns a function to list the crawler IDs from the given crawler client.

(
	clientF func() (*crawler.Client, error),
)

Source from the content-addressed store, hash-verified

32
33// CrawlerIDs returns a function to list the crawler IDs from the given crawler client.
34func CrawlerIDs(
35 clientF func() (*crawler.Client, error),
36) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
37 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
38 client, err := clientF()
39 if err != nil {
40 return nil, cobra.ShellCompDirectiveError
41 }
42 items, err := client.ListAll("", "")
43 if err != nil {
44 return nil, cobra.ShellCompDirectiveError
45 }
46
47 names := make([]string, 0, len(items))
48 for _, crawler := range items {
49 names = append(names, fmt.Sprintf("%s\t%s", crawler.ID, crawler.Name))
50 }
51 return names, cobra.ShellCompDirectiveNoFileComp
52 }
53}

Callers 8

NewGetCmdFunction · 0.92
NewReindexCmdFunction · 0.92
NewPauseCmdFunction · 0.92
NewTestCmdFunction · 0.92
NewCrawlCmdFunction · 0.92
NewUnblockCmdFunction · 0.92
NewStatsCmdFunction · 0.92
NewRunCmdFunction · 0.92

Calls 1

ListAllMethod · 0.80

Tested by

no test coverage detected