MCPcopy Create free account
hub / github.com/cli/cli / writeExpiry

Method writeExpiry

pkg/cmd/auth/status/status.go:182–194  ·  view source on GitHub ↗
(sb *strings.Builder, cs *iostreams.ColorScheme)

Source from the content-addressed store, hash-verified

180}
181
182func (e authEntry) writeExpiry(sb *strings.Builder, cs *iostreams.ColorScheme) {
183 sb.WriteString(" - Expiring token that gh refreshes automatically\n")
184 if e.TokenExpiresAt != nil {
185 expiresAt := e.TokenExpiresAt.UTC()
186 sb.WriteString(fmt.Sprintf(" - Token expires: %s (%s)\n",
187 cs.Bold(expiresAt.Format(time.RFC3339)), relativeToNow(expiresAt)))
188 }
189 if e.RefreshTokenExpiresAt != nil {
190 refreshExpiresAt := e.RefreshTokenExpiresAt.UTC()
191 sb.WriteString(fmt.Sprintf(" - Refresh token expires: %s (%s)\n",
192 cs.Bold(refreshExpiresAt.Format(time.RFC3339)), relativeToNow(refreshExpiresAt)))
193 }
194}
195
196type StatusOptions struct {
197 HttpClient func() (*http.Client, error)

Callers 1

StringMethod · 0.95

Calls 2

relativeToNowFunction · 0.85
BoldMethod · 0.80

Tested by

no test coverage detected