helm-rs 0.1.2

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
use std::path::PathBuf;

use crate::cli::{CliCommand, Invocation};
use crate::command::Create;
use crate::error::{Error, Result};

impl CliCommand for Create {
    fn build(&self, inv: &mut Invocation) -> Result<()> {
        inv.arg("create");
        inv.arg(&self.name);
        inv.option("--starter", self.starter.as_ref());

        Ok(())
    }

    fn parse(&self, stdout: String) -> Result<PathBuf> {
        stdout
            .lines()
            .find_map(|line| line.strip_prefix("Creating "))
            .map(PathBuf::from)
            .ok_or_else(|| Error::Parse {
                command: "helm create",
                message: format!("no `Creating <path>` line in {stdout:?}"),
            })
    }
}