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

Function ShouldUseExpiring

pkg/cmd/auth/shared/login_flow.go:74–79  ·  view source on GitHub ↗

ShouldUseExpiring resolves whether to prefer expiring credentials that gh refreshes automatically. An explicit --expiring flag value wins; when the flag is unset it falls back to the expiring_credentials config setting for the host.

(cfg gh.Config, flagValue *bool, hostname string)

Source from the content-addressed store, hash-verified

72// --expiring flag value wins; when the flag is unset it falls back to the expiring_credentials config setting
73// for the host.
74func ShouldUseExpiring(cfg gh.Config, flagValue *bool, hostname string) bool {
75 if flagValue != nil {
76 return *flagValue
77 }
78 return cfg.ExpiringCredentials(hostname).Value == "enabled"
79}
80
81func Login(opts *LoginOptions) error {
82 cfg := opts.Config

Callers 2

loginRunFunction · 0.92
TestShouldUseExpiringFunction · 0.85

Calls 1

ExpiringCredentialsMethod · 0.65

Tested by 1

TestShouldUseExpiringFunction · 0.68