MCPcopy Index your code
hub / github.com/cli/cli / Select

Method Select

pkg/cmd/pr/shared/templates.go:213–229  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

211}
212
213func (m *templateManager) Select(name string) (Template, error) {
214 if err := m.memoizedFetch(); err != nil {
215 return nil, err
216 }
217
218 if len(m.templates) == 0 {
219 return nil, errors.New("no templates found")
220 }
221
222 for _, t := range m.templates {
223 if t.Name() == name {
224 return t, nil
225 }
226 }
227
228 return nil, fmt.Errorf("template %q not found", name)
229}
230
231func (m *templateManager) memoizedFetch() error {
232 if m.didFetch {

Callers 1

Calls 3

memoizedFetchMethod · 0.95
NameMethod · 0.65
ErrorfMethod · 0.65

Tested by 1