helm-rs 0.1.2

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
//! The CLI side of the release commands: argv building and output parsing for install, upgrade,
//! rollback, uninstall, test and the read commands (`pkg/cmd/*.go`, Helm v4.3.0).
//!
//! Flags that take an optional value (`--dry-run`, `--wait`) or are booleans with a default of
//! true (`install --server-side`) are always written as `--flag=value` ([`Invocation::equals`]).

mod install;
mod lifecycle;
mod read;

pub(in crate::cli) use install::common_flags;

#[cfg(test)]
pub(in crate::cli) mod tests;

use std::collections::BTreeMap;

use super::Invocation;
use crate::command::Force;

/// Writes the choice between `--force-replace` and `--force-conflicts`.
pub(in crate::cli) fn force(inv: &mut Invocation, force: Option<Force>) {
    match force {
        Some(Force::Replace) => inv.arg("--force-replace"),
        Some(Force::Conflicts) => inv.arg("--force-conflicts"),
        None => {}
    }
}

/// Writes `--labels key=value` once per label.
pub(in crate::cli) fn labels(inv: &mut Invocation, labels: &BTreeMap<String, String>) {
    let pairs: Vec<String> = labels.iter().map(|(k, v)| format!("{k}={v}")).collect();

    inv.each("--labels", &pairs);
}