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

Function entryFor

pkg/cmd/open/open.go:277–295  ·  view source on GitHub ↗

entryFor builds the page entry for a shortcut, or returns false if the shortcut is unknown.

(name, baseURL, appID, displayAppID string)

Source from the content-addressed store, hash-verified

275// entryFor builds the page entry for a shortcut, or returns false if the
276// shortcut is unknown.
277func entryFor(name, baseURL, appID, displayAppID string) (pageEntry, bool) {
278 if resource, ok := resourceURLs[name]; ok {
279 url := resource.Default
280 if appID != "" && resource.AppPath != "" {
281 url = fmt.Sprintf("%s/apps/%s/%s", baseURL, appID, resource.AppPath)
282 }
283 return pageEntry{Shortcut: name, URL: url}, true
284 }
285
286 if target, ok := dashboardTargets[name]; ok {
287 return pageEntry{
288 Shortcut: name,
289 URL: dashboardURL(baseURL, displayAppID, target),
290 RequiresLogin: true,
291 }, true
292 }
293
294 return pageEntry{}, false
295}
296
297// allEntries returns every shortcut, sorted by name.
298func (opts *OpenOptions) allEntries() []pageEntry {

Callers 2

printTargetsFunction · 0.85
allEntriesMethod · 0.85

Calls 1

dashboardURLFunction · 0.85

Tested by

no test coverage detected