pub struct Config {
pub mps_dir: PathBuf,
pub storage_dir: PathBuf,
pub log_file: PathBuf,
pub git_remote: String,
pub git_branch: String,
pub default_command: String,
pub type_aliases: HashMap<String, String>,
pub command_aliases: HashMap<String, String>,
pub custom_tags: Vec<String>,
pub notify: NotifyConfig,
pub serve: ServeConfig,
}Expand description
Mirrors ~/.mps_config.yaml written by the Ruby gem. Ruby uses symbol keys (:storage_dir) but the load() normaliser strips them.
Fields§
§mps_dir: PathBuf§storage_dir: PathBuf§log_file: PathBuf§git_remote: String§git_branch: String§default_command: StringWhich command mps (bare invocation) runs. Default: “open”. Ruby supports “list”.
type_aliases: HashMap<String, String>Short-hand element-type aliases: e.g. {“t”: “task”, “n”: “note”} Accepts the legacy “aliases” key for backward compatibility with existing configs.
command_aliases: HashMap<String, String>Short-hand command aliases: e.g. {“a”: “append”, “+”: “append”}
Canonical tag list shared across devices via .mps.meta.
notify: NotifyConfigNotification settings.
serve: ServeConfigHTTP API server settings.
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_config() -> Result<Self, MpsError>
pub fn default_config() -> Result<Self, MpsError>
Default config values using the user home directory.
Sourcepub fn merge_meta(&mut self, meta: &MetaConfig)
pub fn merge_meta(&mut self, meta: &MetaConfig)
Union-merge machine-agnostic settings from .mps.meta into this Config.
Rules:
- type_aliases / command_aliases: union; YAML entry wins on key conflict
- default_command: meta wins if Some
- custom_tags: union, deduplicated
- notify: meta block wins when it contains non-default values
Sourcepub fn load(path: &Path) -> Result<Self, MpsError>
pub fn load(path: &Path) -> Result<Self, MpsError>
Load config from a YAML file. Handles both string and symbol-prefixed keys (Ruby writes :storage_dir, Rust writes storage_dir).
Sourcepub fn init(path: &Path) -> Result<(), MpsError>
pub fn init(path: &Path) -> Result<(), MpsError>
Write default config to path. Does nothing if the file already exists.
Sourcepub fn save(&self, path: &Path) -> Result<(), MpsError>
pub fn save(&self, path: &Path) -> Result<(), MpsError>
Atomically write this config to a YAML file (tmp + rename).
Sourcepub fn ensure_dirs(&self) -> Result<(), MpsError>
pub fn ensure_dirs(&self) -> Result<(), MpsError>
Ensure mps_dir, storage_dir exist and log_file is present.