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

Function runRunCmd

pkg/cmd/crawler/run/run.go:64–101  ·  view source on GitHub ↗
(opts *RunOptions)

Source from the content-addressed store, hash-verified

62}
63
64func runRunCmd(opts *RunOptions) error {
65 if opts.DryRun {
66 summary := map[string]any{
67 "action": "run_crawler",
68 "id": opts.ID,
69 "dryRun": true,
70 }
71
72 return cmdutil.PrintRunSummary(
73 opts.IO,
74 opts.PrintFlags,
75 summary,
76 fmt.Sprintf("Dry run: would run crawler %s", opts.ID),
77 )
78 }
79
80 client, err := opts.CrawlerClient()
81 if err != nil {
82 return err
83 }
84 cs := opts.IO.ColorScheme()
85
86 _, err = client.Run(opts.ID)
87 if err != nil {
88 return err
89 }
90
91 if opts.IO.IsStdoutTTY() {
92 fmt.Fprintf(
93 opts.IO.Out,
94 "%s Crawler %s started\n",
95 cs.SuccessIconWithColor(cs.Green),
96 opts.ID,
97 )
98 }
99
100 return nil
101}

Callers 1

NewRunCmdFunction · 0.85

Calls 5

PrintRunSummaryFunction · 0.92
ColorSchemeMethod · 0.80
IsStdoutTTYMethod · 0.80
SuccessIconWithColorMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected