use std::fs;
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")
}
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"]),
]
};
}