pub struct Config {
pub editor: EditorConfig,
pub open: OpenConfig,
pub hooks: HooksConfig,
}Expand description
Top-level configuration for the worktree CLI.
Fields§
§editor: EditorConfigEditor configuration.
open: OpenConfigWorkspace open behavior.
hooks: HooksConfigHook scripts run around the open command.
Implementations§
Source§impl Config
impl Config
Sourcepub fn path() -> Result<PathBuf>
pub fn path() -> Result<PathBuf>
Return the path to the config file (~/.config/worktree/config.toml).
§Errors
Returns an error if the home directory cannot be determined.
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load config from disk, returning Default if the file does not yet exist.
§Errors
Returns an error if the file cannot be read or parsed.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Persist the current config to disk.
§Errors
Returns an error if the config directory cannot be created or the file cannot be written.
Source§impl Config
impl Config
Sourcepub fn to_toml_with_comments(&self) -> String
pub fn to_toml_with_comments(&self) -> String
Serialize the config to a TOML string with inline documentation comments.
Each section header and field is preceded by a # comment that matches
the doc-comment on the corresponding struct field. The resulting string
round-trips cleanly through toml::from_str.