Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAliasNotFound is returned when the account alias does not exist ErrAliasNotFound = errors.New("alias does not exist") // ErrUnableLoadConfig is returned when the config cannot be loaded from config dir ErrUnableLoadConfig = errors.New("unable to load config from config directory") // ErrUnableSafeConfig is returned when the config cannot be safed to config dir ErrUnableSafeConfig = errors.New("unable to safe config from config directory") // ErrUnableLocateHomeDir is returned when the home dir cannot be located ErrUnableLocateHomeDir = errors.New("unable to locate home directory") // ErrInvalidArgument is returned when invalid arguments have been passed to function ErrInvalidArgument = errors.New("argument is invalid or was nil") )
Functions ¶
func GetConfigDir ¶
GetConfigDir constructs go-t client config folder.
func GetConfigPath ¶
GetConfigPath onstructs go-t client configuration path.
func IsConfigExists ¶
func IsConfigExists() bool
IsConfigExists returns false if config doesn't exist.
func IsValidAlias ¶
IsValidAlias Check if an account alias valid.
func SaveConfig ¶
SaveConfig saves the configuration file and returns error if any.
func SetConfigDir ¶
func SetConfigDir(configDir string)
SetConfigDir sets a custom go-t client config folder.
Types ¶
type AccountConfig ¶
type AccountConfig struct { ConsumerKey string `json:"consumerKey"` ConsumerSecret string `json:"consumerSecret"` AccessToken string `json:"accessToken"` AccessSecret string `json:"accessSecret"` }
AccountConfig represents twitter app auth credentials
func GetAccountConfig ¶
func GetAccountConfig(alias string) (*AccountConfig, error)
GetAccountConfig retrieves account specific configuration.
type Config ¶
type Config struct { Version string `json:"version"` Context string `json:"context"` Accounts map[string]AccountConfig `json:"account"` }
Config represents the cli config
func (*Config) GetAccountByContext ¶
func (c *Config) GetAccountByContext() (*AccountConfig, error)
GetAccountByContext retrieves account specific configuration.
func (*Config) GetAccountConfig ¶
func (c *Config) GetAccountConfig(alias string) (*AccountConfig, error)
GetAccountConfig retrieves account specific configuration.
Click to show internal directories.
Click to hide internal directories.