Documentation ¶
Index ¶
- Constants
- Variables
- func Append(urlStr string, token string, remoteType rt.Type) error
- func List() error
- func Remove(config *Config, configIndex int, detailsIndex int) error
- func Update(config *Config, configIndex int, detailsIndex int, url string, token string) error
- func UpdateColors(c Colors, config *Config) error
- func UpdateRemote() error
- func VerifyTokens() error
- type Colors
- type Config
- type Remote
Constants ¶
const ErrConfigDoesNotExistMsg = "No configuration exists.\nRun `gin config add` to add remotes"
Variables ¶
var ErrConfigDoesNotExist = errors.New("config does not exist")
ErrConfigDoesNotExist is returned by Load if no configuration file exists.
var ErrUpdateSameValues = errors.New("called update config with existing values")
ErrUpdateSameValues is returned if Update was called with the same url and token that is already stored in the configuration file.
Functions ¶
func Append ¶
Append adds the token to the corresponding host in the configuration file. If no configuration file exists, a new one will be created.
func UpdateColors ¶
UpdateColors sets the colors in the configuration to the provided values and writes the updated configuration back.
func UpdateRemote ¶
func UpdateRemote() error
UpdateRemote loads the configuration file and updates the username and token name associated with each token.
func VerifyTokens ¶
func VerifyTokens() error
VerifyTokens loads the configuration file and checks if every token is valid.
Types ¶
type Colors ¶
Colors contains hex strings of colors for the different styles.
func (*Colors) CheckValidity ¶
CheckValidity checks if the colors in the struct are valid hex strings. Empty strings are ignored.
type Config ¶
Config contains the Colors configurations, a Version number and a list of Remotes.
func Load ¶
Load returns the config located at '~/.config/gin/config.toml' if it exists. If it does not exist, function returns a ErrConfigDoesNotExist error and an initialized Config.
func (*Config) GetMatchingConfig ¶
GetMatchingConfig searches the config's Remotes and returns a remote.Match if a Remote has the same URL as one of the passed repository.Details.