Documentation
¶
Index ¶
- func Domain(forgeType string) string
- func ForgeForDomain(domain string) (forges.Forge, error)
- func HTTPClient() *http.Client
- func Repo(flagRepo, flagForgeType string) (forge forges.Forge, owner, repo, domain string, err error)
- func SetForgeType(forgeType string)
- func SetHost(host string)
- func SetRemote(name string)
- func SetUserAgent(ua string)
- func TokenForDomain(domain string) string
- func TokenForDomainEnv(domain string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Domain ¶ added in v0.5.0
Domain decides which forge host to talk to when the user supplies a bare owner or owner/repo argument. Precedence: --host flag, FORGE_HOST env, explicit --forge-type, the current directory's git remote, the config default forge type, then github.com.
func ForgeForDomain ¶
ForgeForDomain returns a Forge instance for the given domain. If the domain isn't a known forge, it checks config then probes the server.
func HTTPClient ¶ added in v0.4.0
HTTPClient returns an http.Client whose transport sets the User-Agent header on outbound requests. Used for all forge API traffic so requests are identifiable in server logs.
func Repo ¶
func Repo(flagRepo, flagForgeType string) (forge forges.Forge, owner, repo, domain string, err error)
Repo figures out the forge, owner, and repo name from flags or the current git remote. The -R flag takes precedence; otherwise we read the "origin" remote URL and parse it.
func SetForgeType ¶ added in v0.5.0
func SetForgeType(forgeType string)
SetForgeType forces the API client implementation for the resolved domain, skipping config lookup and network probing. The CLI calls this from the --forge-type persistent flag. An empty string is ignored.
func SetHost ¶ added in v0.5.0
func SetHost(host string)
SetHost forces a specific forge domain, taking precedence over FORGE_HOST, --forge-type, and git remote detection. The CLI calls this from the --host persistent flag. An empty string is ignored.
func SetRemote ¶ added in v0.4.0
func SetRemote(name string)
SetRemote sets which git remote to read when resolving the current repository. The CLI calls this from the --remote persistent flag. An empty string is ignored so callers can pass the flag value unconditionally.
func SetUserAgent ¶ added in v0.4.0
func SetUserAgent(ua string)
SetUserAgent sets the User-Agent string sent on every HTTP request made through HTTPClient. The CLI calls this at startup with the build version.
func TokenForDomain ¶
TokenForDomain looks up an auth token. Checks environment variables first (highest precedence), then falls back to the user config file.
func TokenForDomainEnv ¶
TokenForDomainEnv looks up a token from environment variables only. Checks domain-specific variables first, then falls back to FORGE_TOKEN.
Types ¶
This section is empty.