Documentation
¶
Overview ¶
Package mode stores the user's display preference (super-compact vs standard) in a global file under XDG_CONFIG_HOME (or $HOME/.config). Phase 4.2.a: real implementation — XDG-aware path, atomic write, flock.
Index ¶
Constants ¶
const Default = Standard
Default is returned by Load when the file is missing or its contents do not match a known Mode.
Variables ¶
This section is empty.
Functions ¶
func Path ¶
func Path() string
Path returns the absolute path of the mode storage file. Resolves via XDG_CONFIG_HOME when set, otherwise falls back to $HOME/.config/cc-probeline/mode. Returns "" when both XDG_CONFIG_HOME and HOME are empty. Decision C-1: global single file, not per-session/per-cwd.
func Save ¶
Save persists m atomically to the mode storage file. Write sequence: MkdirAll → write to <path>.tmp → rename to <path>. The entire write is guarded by a flock on <path>.lock (a separate lock file so that concurrent readers on the mode file itself are never blocked). Decision C-2: atomic .tmp+rename; flock on dedicated .lock file.
Types ¶
type Mode ¶
type Mode string
Mode names the rendering mode selected by the user.
func Load ¶
func Load() Mode
Load reads the persisted Mode from disk. Returns Default (Standard) when the file does not exist, Path() is empty, or the file contains an unrecognised value. Whitespace around the stored value is trimmed. Decision C-3: Default = Standard on any error or unknown value.