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

Method Run

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

Source from the content-addressed store, hash-verified

286}
287
288func (c *SearchConsoleSitemapsGetCmd) Run(ctx context.Context, flags *RootFlags) error {
289 u := ui.FromContext(ctx)
290 siteURL := strings.TrimSpace(c.SiteURL)
291 if siteURL == "" {
292 return usage("empty siteUrl")
293 }
294 feedPath := strings.TrimSpace(c.FeedPath)
295 if feedPath == "" {
296 return usage("empty feedpath")
297 }
298
299 account, err := requireAccount(flags)
300 if err != nil {
301 return err
302 }
303
304 svc, err := searchConsoleService(ctx, account)
305 if err != nil {
306 return err
307 }
308 sitemap, err := svc.Sitemaps.Get(siteURL, feedPath).Context(ctx).Do()
309 if err != nil {
310 return wrapSearchConsoleError(err)
311 }
312
313 if outfmt.IsJSON(ctx) {
314 return outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{
315 "sitemap": sitemap,
316 })
317 }
318
319 return writeResult(ctx, u,
320 kv("path", sitemap.Path),
321 kv("type", sitemap.Type),
322 kv("pending", sitemap.IsPending),
323 kv("warnings", sitemap.Warnings),
324 kv("errors", sitemap.Errors),
325 kv("last_submitted", sitemap.LastSubmitted),
326 kv("last_downloaded", sitemap.LastDownloaded),
327 kv("contents", formatSearchConsoleSitemapContents(sitemap.Contents)),
328 )
329}
330
331type SearchConsoleSitemapsSubmitCmd struct {
332 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 13

FromContextFunction · 0.92
IsJSONFunction · 0.92
WriteJSONFunction · 0.92
usageFunction · 0.85
requireAccountFunction · 0.85
searchConsoleServiceFunction · 0.85
wrapSearchConsoleErrorFunction · 0.85
stdoutWriterFunction · 0.85
writeResultFunction · 0.85
kvFunction · 0.85
DoMethod · 0.65

Tested by

no test coverage detected