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

Function printTargets

pkg/cmd/open/open.go:242–259  ·  view source on GitHub ↗

printTargets renders page metadata with the configured printer. When listing, every shortcut is printed; otherwise only the requested shortcut is printed.

(opts *OpenOptions, listing bool)

Source from the content-addressed store, hash-verified

240// printTargets renders page metadata with the configured printer. When listing,
241// every shortcut is printed; otherwise only the requested shortcut is printed.
242func printTargets(opts *OpenOptions, listing bool) error {
243 printer, err := opts.PrintFlags.ToPrinter()
244 if err != nil {
245 return err
246 }
247
248 if listing {
249 return printer.Print(opts.IO, opts.allEntries())
250 }
251
252 baseURL, appID, displayAppID := opts.resolveScope()
253 entry, ok := entryFor(opts.Shortcut, baseURL, appID, displayAppID)
254 if !ok {
255 return unsupportedShortcutError(opts.Shortcut)
256 }
257
258 return printer.Print(opts.IO, entry)
259}
260
261// resolveScope returns the dashboard base URL and the application id used to
262// build dashboard links. displayAppID falls back to a placeholder so links can

Callers 1

runOpenCmdFunction · 0.85

Calls 6

entryForFunction · 0.85
unsupportedShortcutErrorFunction · 0.85
allEntriesMethod · 0.80
resolveScopeMethod · 0.80
PrintMethod · 0.65
ToPrinterMethod · 0.45

Tested by

no test coverage detected