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

Function ShouldUseExpiring

pkg/cmd/auth/shared/login_flow.go:73–78  ·  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

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

Callers 2

loginRunFunction · 0.92
TestShouldUseExpiringFunction · 0.85

Calls 1

ExpiringCredentialsMethod · 0.65

Tested by 1

TestShouldUseExpiringFunction · 0.68