Documentation
¶
Index ¶
- Constants
- func AttachmentsDir() (string, error)
- func ClientCredentialsExists(client string) (bool, error)
- func ClientCredentialsPath(client string) (string, error)
- func ClientsDir() (string, error)
- func ConfigExists() (bool, error)
- func ConfigPath() (string, error)
- func DeleteAccountAlias(alias string) (bool, error)
- func DeleteClientCredentials(client string) error
- func Dir() (string, error)
- func DomainFromEmail(email string) string
- func EnsureAttachmentsDir() (string, error)
- func EnsureClientsDir() (string, error)
- func EnsureDir() (string, error)
- func EnsureKeyringDir() (string, error)
- func ExpandPath(path string) (string, error)
- func KeyringDir() (string, error)
- func ListAccountAliases() (map[string]string, error)
- func NormalizeAccountAlias(alias string) string
- func NormalizeClientName(raw string) (string, error)
- func NormalizeClientNameOrDefault(raw string) (string, error)
- func NormalizeDomain(raw string) (string, error)
- func ResolveAccount(flagAccount string) (string, error)
- func ResolveClientForAccount(email, override string) (string, error)
- func SetAccountAlias(alias, email string) error
- func SetAccountDomain(domain, client string) error
- func SetDefaultAccount(account string) error
- func WriteClientCredentials(client string, creds OAuthCredentials) error
- func WriteConfig(cfg File) error
- type ClientInfo
- type File
- type OAuthCredentials
Constants ¶
const AppName = "frontcli"
const DefaultClientName = "default"
Variables ¶
This section is empty.
Functions ¶
func AttachmentsDir ¶
func ClientCredentialsExists ¶
ClientCredentialsExists checks if credentials exist for a client.
func ClientCredentialsPath ¶
ClientCredentialsPath returns the path to credentials for a client.
func ClientsDir ¶
func ConfigExists ¶
func ConfigPath ¶
func DeleteAccountAlias ¶
DeleteAccountAlias removes an alias.
func DeleteClientCredentials ¶
DeleteClientCredentials removes OAuth credentials for a client.
func DomainFromEmail ¶
DomainFromEmail extracts the domain from an email address.
func EnsureAttachmentsDir ¶
func EnsureClientsDir ¶
func EnsureKeyringDir ¶
func ExpandPath ¶
ExpandPath expands ~ at the beginning of a path to the user's home directory.
func KeyringDir ¶
func ListAccountAliases ¶
ListAccountAliases returns all configured aliases.
func NormalizeAccountAlias ¶
NormalizeAccountAlias normalizes an account alias to lowercase.
func NormalizeClientName ¶
NormalizeClientName validates and normalizes a client name.
func NormalizeClientNameOrDefault ¶
NormalizeClientNameOrDefault normalizes a client name, defaulting to "default" if empty.
func NormalizeDomain ¶
NormalizeDomain validates and normalizes a domain name.
func ResolveAccount ¶
ResolveAccount resolves the account email from flags, env, or config. Resolution order: flag → env (FRONT_ACCOUNT) → config default → error
func ResolveClientForAccount ¶
ResolveClientForAccount resolves the OAuth client for an account. Resolution order: explicit override → domain mapping → default
func SetAccountAlias ¶
SetAccountAlias sets an alias for an account email.
func SetAccountDomain ¶
SetAccountDomain maps a domain to an OAuth client.
func SetDefaultAccount ¶
SetDefaultAccount sets the default account.
func WriteClientCredentials ¶
func WriteClientCredentials(client string, creds OAuthCredentials) error
WriteClientCredentials writes OAuth credentials for a client.
func WriteConfig ¶
Types ¶
type ClientInfo ¶
type ClientInfo struct {
Name string `json:"name"`
Path string `json:"path"`
Default bool `json:"default"`
}
ClientInfo holds information about a configured OAuth client.
func ListClients ¶
func ListClients() ([]ClientInfo, error)
ListClients returns all configured OAuth clients.
type File ¶
type File struct {
DefaultAccount string `yaml:"default_account,omitempty"`
AccountAliases map[string]string `yaml:"account_aliases,omitempty"`
AccountDomains map[string]string `yaml:"account_domains,omitempty"`
DefaultOutput string `yaml:"default_output,omitempty"`
Timezone string `yaml:"timezone,omitempty"`
}
func ReadConfig ¶
type OAuthCredentials ¶
type OAuthCredentials struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
RedirectURI string `json:"redirect_uri,omitempty"`
}
OAuthCredentials holds OAuth client credentials for the Front API.
func ReadClientCredentials ¶
func ReadClientCredentials(client string) (OAuthCredentials, error)
ReadClientCredentials reads OAuth credentials for a client.