zenops 0.20.0

Declarative system configuration management for shell config and dotfiles.
//! Diagnostic strings for "single-key TOML table" deserializers.
//!
//! Both `condition.rs` and `pkg/detect.rs` represent a closed set of
//! variants as a TOML table with exactly one of N expected keys. The
//! error wording is identical and worth keeping in sync — the only thing
//! that varies is the noun ("condition" / "detect") and the set of
//! accepted kinds. Callers wrap each string in `de::Error::custom`.

/// "a condition table with exactly one of: os, shell, …"
pub(super) fn expecting_msg(noun: &str, kinds: &[&str]) -> String {
    format!("a {noun} table with exactly one of: {}", kinds.join(", "))
}

/// "empty condition table; expected exactly one of: os, shell, …"
pub(super) fn empty_table_msg(noun: &str, kinds: &[&str]) -> String {
    format!(
        "empty {noun} table; expected exactly one of: {}",
        kinds.join(", ")
    )
}

/// "unknown condition kind 'foo', expected one of: os, shell, …"
pub(super) fn unknown_kind_msg(noun: &str, key: &str, kinds: &[&str]) -> String {
    format!(
        "unknown {noun} kind '{key}', expected one of: {}",
        kinds.join(", ")
    )
}

/// "condition must have exactly one kind, found 'x' and 'y'"
pub(super) fn extra_key_msg(noun: &str, first: &str, extra: &str) -> String {
    format!("{noun} must have exactly one kind, found '{first}' and '{extra}'")
}