helm-rs 0.1.1

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
use super::{CliCommand, Invocation, flags};
use crate::command::{RegistryLogin, RegistryLogout};
use crate::error::Result;

#[cfg(test)]
mod tests;

impl CliCommand for RegistryLogin {
    fn build(&self, inv: &mut Invocation) -> Result<()> {
        inv.arg("registry");
        inv.arg("login");
        inv.arg(&self.host);

        flags! { inv, self;
            option("--username", username);
            option("--cert-file", cert_file);
            option("--key-file", key_file);
            option("--ca-file", ca_file);
            switch("--insecure", insecure);
            switch("--plain-http", plain_http);
        }

        if let Some(password) = &self.password {
            inv.arg("--password-stdin");
            inv.stdin = Some(password.expose().as_bytes().to_vec());
        }

        Ok(())
    }

    fn parse(&self, _stdout: String) -> Result<()> {
        Ok(())
    }
}

impl CliCommand for RegistryLogout {
    fn build(&self, inv: &mut Invocation) -> Result<()> {
        inv.arg("registry");
        inv.arg("logout");
        inv.arg(&self.host);

        Ok(())
    }

    fn parse(&self, _stdout: String) -> Result<()> {
        Ok(())
    }
}