Documentation
¶
Overview ¶
Package config holds hopsesh's user configuration and state locations.
Index ¶
Constants ¶
const Schema = 3
Schema is the configuration format. Files in another format are refused, never read: hopsesh keeps no code for older formats.
Variables ¶
var ErrOldConfig = errors.New("the configuration was written by an older hopsesh")
ErrOldConfig means the configuration file was written by an older hopsesh.
Functions ¶
func Dir ¶
func Dir() string
Dir is the configuration directory: $XDG_CONFIG_HOME/hopsesh or ~/.config/hopsesh on macOS and Linux, %APPDATA%\hopsesh on Windows.
Types ¶
type Agent ¶ added in v0.3.0
type Agent struct {
// Disabled leaves the agent out of scans and moves.
Disabled bool `toml:"disabled,omitempty"`
// RemoteControl turns the agent's own remote control on for continued sessions.
RemoteControl bool `toml:"remote_control,omitempty"`
// Import has the agent's own importer convert sessions continued in it, by default.
Import bool `toml:"import,omitempty"`
}
Agent is per-agent configuration, by module id.
type Config ¶
type Config struct {
Schema int `toml:"schema"`
ReposDir string `toml:"repos_dir"` // where clones go; default ~/git
Layout string `toml:"layout"` // flat | ghq
// UpdateCheck is "on" or "off" once the person has answered whether the app may
// look for new releases once a day ("" = not asked yet).
UpdateCheck string `toml:"update_check,omitempty"`
// Round trips. MarkMoved and SyncCode default to on (nil); PushSource to off.
MarkMoved *bool `toml:"mark_moved,omitempty"` // mark the copy left behind
SyncCode *bool `toml:"sync_code,omitempty"` // fetch and fast-forward the checkout here
PushSource bool `toml:"push_source,omitempty"` // push unpushed commits on the source first
// SkillPrompt remembers the answer to "let your agents use hopsesh?": "" (not asked),
// "declined", or the skill revision last offered.
SkillPrompt string `toml:"skill_prompt,omitempty"`
// CLIPrompt is "declined" once the user said not now to linking the command-line tool
// from the app.
CLIPrompt string `toml:"cli_prompt,omitempty"`
// AppIcons shows an agent's installed desktop app icon in the app (default on).
AppIcons *bool `toml:"app_icons,omitempty"`
Agents map[string]Agent `toml:"agents,omitempty"`
Peer Peer `toml:"peer"`
Hosts []Host `toml:"hosts"`
}
Config is the user's configuration file.
func Load ¶
Load reads the configuration, filling defaults for missing values. A file in another format is refused with ErrOldConfig.
func (Config) AgentEnabled ¶ added in v0.3.0
AgentEnabled reports whether an agent module is in use.
func (Config) AppIconsOn ¶ added in v0.3.0
AppIconsOn reports whether installed desktop apps' icons picture the agents (default on).
func (Config) MarkMovedOn ¶ added in v0.2.0
MarkMovedOn reports whether copies left behind are marked (default on).
func (Config) SyncCodeOn ¶ added in v0.2.0
SyncCodeOn reports whether the checkout is brought to the session's commit (default on).
func (*Config) UpsertHost ¶
UpsertHost adds or updates a host by name, keeping consent unless explicitly changed.
type Host ¶
type Host struct {
Name string `toml:"name"` // label shown to the user, e.g. "studio"
Destination string `toml:"destination"` // what to pass to ssh: alias, user@host or host
Via string `toml:"via"` // tailscale | ssh-config | manual (or a "+" combination)
Allowed bool `toml:"allowed"` // the user consented to hopsesh connecting
OS string `toml:"os,omitempty"`
// TailscaleName is the machine's MagicDNS name, used when Destination's own host
// name does not resolve (e.g. an alias pointing at a .local name on another network).
TailscaleName string `toml:"tailscale_name,omitempty"`
// Auth is "password" for a machine that logs in with a password (asked for, never
// stored in this file); "" means keys or the SSH agent.
Auth string `toml:"auth,omitempty"`
// Keychain: remember this machine's password in the macOS Keychain.
Keychain bool `toml:"keychain,omitempty"`
}
Host is one machine hopsesh knows about.
func (Host) UsesPassword ¶ added in v0.2.0
UsesPassword reports whether the machine logs in with a password.