cli/pkg/cmd/auth/shared/writeable.go
Kynan Ware 65fcba95d9 Add godoc comments to exported symbols in pkg/cmd/auth
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 16:08:04 -07:00

13 lines
378 B
Go

package shared
import (
"strings"
"github.com/cli/cli/v2/internal/gh"
)
// AuthTokenWriteable returns the token source and whether the token for the given hostname can be modified.
func AuthTokenWriteable(authCfg gh.AuthConfig, hostname string) (string, bool) {
token, src := authCfg.ActiveToken(hostname)
return src, (token == "" || !strings.HasSuffix(src, "_TOKEN"))
}