MCPcopy Create free account
hub / github.com/openclaw/gogcli / Run

Method Run

internal/cmd/searchconsole.go:336–375  ·  view source on GitHub ↗
(ctx context.Context, flags *RootFlags)

Source from the content-addressed store, hash-verified

334}
335
336func (c *SearchConsoleSitemapsSubmitCmd) Run(ctx context.Context, flags *RootFlags) error {
337 u := ui.FromContext(ctx)
338 siteURL := strings.TrimSpace(c.SiteURL)
339 if siteURL == "" {
340 return usage("empty siteUrl")
341 }
342 feedPath := strings.TrimSpace(c.FeedPath)
343 if feedPath == "" {
344 return usage("empty feedpath")
345 }
346 if err := validateSearchConsoleSitemapURL(feedPath); err != nil {
347 return err
348 }
349
350 if err := dryRunExit(ctx, flags, "searchconsole.sitemaps.submit", map[string]any{
351 "site_url": siteURL,
352 "feed_path": feedPath,
353 }); err != nil {
354 return err
355 }
356
357 account, err := requireAccount(flags)
358 if err != nil {
359 return err
360 }
361
362 svc, err := searchConsoleService(ctx, account)
363 if err != nil {
364 return err
365 }
366 if err := svc.Sitemaps.Submit(siteURL, feedPath).Context(ctx).Do(); err != nil {
367 return wrapSearchConsoleError(err)
368 }
369
370 return writeResult(ctx, u,
371 kv("submitted", true),
372 kv("site_url", siteURL),
373 kv("feed_path", feedPath),
374 )
375}
376
377type SearchConsoleSitemapsDeleteCmd struct {
378 SiteURL string `arg:"" name:"siteUrl" help:"Search Console property URL (e.g. https://example.com/ or sc-domain:example.com)"`

Callers

nothing calls this directly

Calls 10

FromContextFunction · 0.92
usageFunction · 0.85
dryRunExitFunction · 0.85
requireAccountFunction · 0.85
searchConsoleServiceFunction · 0.85
wrapSearchConsoleErrorFunction · 0.85
writeResultFunction · 0.85
kvFunction · 0.85
DoMethod · 0.65

Tested by

no test coverage detected