Documentation
¶
Index ¶
- Constants
- func CacheDir() string
- func ConfigDir() string
- func Cover() string
- func HelpHidden() bool
- func LastCalendarID() int64
- func NonInteractiveEnv() bool
- func SaveCover(preset string) error
- func SaveHelpHidden(hidden bool) error
- func SaveLastCalendarID(id int64) error
- func ScrubLegacyCredentials() error
- func StateDir() string
- type Config
- func (c *Config) LocalConfig() *LocalConfig
- func (c *Config) SaveAccountID(accountID string) error
- func (c *Config) SaveBaseURL(baseURL string) error
- func (c *Config) SaveOnboarded(onboarded bool) error
- func (c *Config) SetFromFlag(key, value string) error
- func (c *Config) SourceOf(key string) Source
- func (c *Config) TrustLocalConfig() error
- func (c *Config) UntrustLocalConfig() error
- func (c *Config) UntrustedLocalConfig() *LocalConfig
- type LocalConfig
- type OldConfig
- type Source
- type TrustedLocalConfig
Constants ¶
const (
AllAccounts = "all"
)
Variables ¶
This section is empty.
Functions ¶
func Cover ¶ added in v0.2.0
func Cover() string
Cover is the art over the Imbox's Previously Seen, or "" for none.
It is stored here rather than read from HEY on purpose. The web app keeps a cover per box in its own table, but no client reads that: the iOS and Android apps each keep their own choice in device preferences, with their own set of presets, and never ask the server. This is the same decision, and it is the reason a cover set here does not show up on the web.
func HelpHidden ¶ added in v0.2.0
func HelpHidden() bool
HelpHidden reports whether the TUI's shortcut help is hidden.
func LastCalendarID ¶ added in v0.2.0
func LastCalendarID() int64
LastCalendarID is the calendar the last event was filed on, so the next new event opens on the same one. Somebody who keeps a work calendar and a personal one is nearly always adding to whichever they added to last, and the first in the list is a poor guess about which that is.
It lives here rather than on HEY for the reason Cover does: HEY serves no such preference, and making one up on the server for one client to read would be worse than remembering it locally.
func NonInteractiveEnv ¶ added in v0.2.0
func NonInteractiveEnv() bool
NonInteractiveEnv reports whether HEY_NONINTERACTIVE is set to a truthy value. When true, the CLI must not show interactive prompts regardless of TTY detection. This is an escape hatch for agents and harnesses that run the CLI under an allocated PTY (where stdio looks like a terminal) and want to avoid a prompt wedging the session — without forcing a machine output format the way --agent does.
func SaveCover ¶ added in v0.2.0
SaveCover stores the Imbox's cover, leaving every other setting alone. An empty preset drops the key rather than writing a blank one.
func SaveHelpHidden ¶ added in v0.2.0
SaveHelpHidden stores whether the TUI's shortcut help is hidden, leaving every other setting alone.
func SaveLastCalendarID ¶ added in v0.2.0
SaveLastCalendarID stores it, leaving every other setting alone.
func ScrubLegacyCredentials ¶ added in v0.2.0
func ScrubLegacyCredentials() error
ScrubLegacyCredentials removes migrated embedded credentials from the global config file. Call only after the credential store confirmed the save.
Types ¶
type Config ¶
type Config struct {
BaseURL string `json:"base_url"`
AccountID string `json:"account_id,omitempty"`
Onboarded bool `json:"onboarded,omitempty"`
// contains filtered or unexported fields
}
func Defaults ¶ added in v0.2.0
func Defaults() *Config
Defaults is the configuration before any file or environment is consulted: the fallback for commands that must run even when the global file is broken.
func Load ¶
Load reads the effective configuration: defaults, the global file, a repository-local .hey/config.json found from the working directory, then the environment.
func LoadGlobal ¶ added in v0.2.0
LoadGlobal reads the configuration without any repository-local file. It is for commands that run from an arbitrary working directory on the user's behalf — a desktop bar poller, say — where a checkout's config must neither redirect them nor trip the local-config trust gate.
func (*Config) LocalConfig ¶
func (c *Config) LocalConfig() *LocalConfig
LocalConfig returns the discovered local configuration and its trust status.
func (*Config) SaveAccountID ¶
SaveAccountID stores the default linked-account filter for the effective server without replacing settings for any other server.
func (*Config) SaveBaseURL ¶
SaveBaseURL stores the global server URL while preserving account defaults for every server.
func (*Config) SaveOnboarded ¶ added in v0.2.0
SaveOnboarded stores the onboarding flag in the global config so later logged-out runs of bare `hey` skip the full first-run wizard.
func (*Config) SetFromFlag ¶
func (*Config) TrustLocalConfig ¶
TrustLocalConfig trusts the current security-sensitive values in the discovered local configuration. A later change produces a different digest and requires trust again.
func (*Config) UntrustLocalConfig ¶
UntrustLocalConfig removes trust for the discovered local configuration.
func (*Config) UntrustedLocalConfig ¶
func (c *Config) UntrustedLocalConfig() *LocalConfig
UntrustedLocalConfig returns the local configuration when one of its values is effective for this invocation and the user has not trusted its current contents.
type LocalConfig ¶
type LocalConfig struct {
Path string `json:"path"`
BaseURL string `json:"base_url,omitempty"`
AccountID string `json:"account_id,omitempty"`
ServerOrigin string `json:"server_origin"`
Digest string `json:"digest"`
Trusted bool `json:"trusted"`
}
LocalConfig describes the security-sensitive settings supplied by the nearest repository-local .hey/config.json file.
type OldConfig ¶
type OldConfig struct {
BaseURL string `json:"base_url"`
AccessToken string `json:"access_token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
TokenExpiry int64 `json:"token_expiry,omitempty"`
SessionCookie string `json:"session_cookie,omitempty"`
}
OldConfig represents the legacy config format with embedded credentials. Used only for migration.
type TrustedLocalConfig ¶
type TrustedLocalConfig struct {
Path string `json:"path"`
ServerOrigin string `json:"server_origin"`
BaseURL string `json:"base_url,omitempty"`
AccountID string `json:"account_id,omitempty"`
Digest string `json:"digest"`
}
TrustedLocalConfig identifies a repository-local configuration trusted by this user.
func TrustedLocalConfigs ¶
func TrustedLocalConfigs() ([]TrustedLocalConfig, error)
TrustedLocalConfigs returns the local configurations trusted in user-level config.