Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMethodForHost ¶ added in v0.0.2
AuthMethodForHost returns the authentication method for a given host ("pat", "oauth", or "").
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the directory where config files are stored.
func DefaultHost ¶
func DefaultHost() string
DefaultHost returns "gitlab.com" or the value of GITLAB_HOST env var.
func SaveHosts ¶
func SaveHosts(hosts HostsConfig) error
SaveHosts writes the hosts configuration to disk.
func TokenForHost ¶
TokenForHost returns the authentication token for a given host.
Types ¶
type Config ¶
type Config struct {
Editor string `json:"editor,omitempty"`
Pager string `json:"pager,omitempty"`
Browser string `json:"browser,omitempty"`
Protocol string `json:"protocol,omitempty"` // "https" or "ssh"
GitRemote string `json:"git_remote,omitempty"`
}
Config holds the application configuration.
type HostConfig ¶
type HostConfig struct {
Token string `json:"token"`
User string `json:"user,omitempty"`
Protocol string `json:"protocol,omitempty"`
APIHost string `json:"api_host,omitempty"`
AuthMethod string `json:"auth_method,omitempty"` // "pat" or "oauth"
}
HostConfig stores per-host authentication and settings.
type HostsConfig ¶
type HostsConfig map[string]*HostConfig
HostsConfig maps hostnames to their configurations.
func LoadHosts ¶
func LoadHosts() (HostsConfig, error)
LoadHosts reads the hosts configuration from disk.
Click to show internal directories.
Click to hide internal directories.