helm-rs 0.1.2

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
//! Shared rows of the argv tests of the commands that fetch a chart (`pull` and `show`).

use std::fs;

/// The text of a capture under `tests/fixtures/commands/fetch/captures`, made by the local Helm.
pub(super) fn capture(name: &str) -> String {
    let path = format!(
        "{}/tests/fixtures/commands/fetch/captures/{name}",
        env!("CARGO_MANIFEST_DIR")
    );

    fs::read_to_string(path).expect("capture")
}

/// One row per chart download flag of a command that has a `chart_path` field, as
/// `FlagRow`s (the password is covered by its own test).
macro_rules! download_rows {
    ($command:ty) => {
        [
            (
                "version",
                (|c| c.chart_path.version = Some("^2.0.0".into())) as fn(&mut $command),
                &["--version", "^2.0.0"] as &[&str],
            ),
            ("verify", |c| c.chart_path.verify = true, &["--verify"]),
            (
                "keyring",
                |c| c.chart_path.keyring = Some(std::path::PathBuf::from("/k.gpg")),
                &["--keyring", "/k.gpg"],
            ),
            (
                "repo",
                |c| c.chart_path.repo = Some("https://charts.example".into()),
                &["--repo", "https://charts.example"],
            ),
            (
                "username",
                |c| c.chart_path.username = Some("alice".into()),
                &["--username", "alice"],
            ),
            (
                "cert-file",
                |c| c.chart_path.cert_file = Some(std::path::PathBuf::from("/c.pem")),
                &["--cert-file", "/c.pem"],
            ),
            (
                "key-file",
                |c| c.chart_path.key_file = Some(std::path::PathBuf::from("/k.pem")),
                &["--key-file", "/k.pem"],
            ),
            (
                "ca-file",
                |c| c.chart_path.ca_file = Some(std::path::PathBuf::from("/ca.pem")),
                &["--ca-file", "/ca.pem"],
            ),
            (
                "insecure-skip-tls-verify",
                |c| c.chart_path.insecure_skip_tls_verify = true,
                &["--insecure-skip-tls-verify"],
            ),
            (
                "plain-http",
                |c| c.chart_path.plain_http = true,
                &["--plain-http"],
            ),
            (
                "pass-credentials",
                |c| c.chart_path.pass_credentials = true,
                &["--pass-credentials"],
            ),
            ("devel", |c| c.devel = true, &["--devel"]),
        ]
    };
}