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

Method CurrentUsername

pkg/cmd/status/status.go:217–234  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215}
216
217func (s *StatusGetter) CurrentUsername() (string, error) {
218 s.usernameMu.Lock()
219 defer s.usernameMu.Unlock()
220
221 if s.currentUsername != "" {
222 return s.currentUsername, nil
223 }
224
225 cachedClient := s.CachedClient(time.Hour * 48)
226 cachingAPIClient := api.NewClientFromHTTP(cachedClient)
227 currentUsername, err := api.CurrentLoginName(cachingAPIClient, s.hostname())
228 if err != nil {
229 return "", fmt.Errorf("failed to get current username: %w", err)
230 }
231
232 s.currentUsername = currentUsername
233 return currentUsername, nil
234}
235
236func (s *StatusGetter) ActualMention(commentURL string) (string, error) {
237 currentUsername, err := s.CurrentUsername()

Callers 2

ActualMentionMethod · 0.95
LoadEventsMethod · 0.95

Calls 3

CachedClientMethod · 0.95
hostnameMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected