tyt-preferences 0.1.6

Preference loading from .tytconfig files for tyt sub-crates.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::{Dependencies, DeserializePrefs};
use std::io::Result as IOResult;

/// Loads preferences for the given key from `<git-root>/.tytconfig`.
pub fn load_git_prefs<T: DeserializePrefs>(
    dependencies: &impl Dependencies,
    key: &str,
) -> IOResult<Option<T>> {
    let Some(dir) = dependencies.git_root_dir()? else {
        return Ok(None);
    };
    crate::load_prefs_from_dir(dependencies, &dir, key)
}