feat: make sure dir is there as well

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-01-28 16:41:50 +01:00
parent cc7aaf14eb
commit 85cc1d46db
15 changed files with 1153 additions and 447 deletions

View File

@@ -0,0 +1,31 @@
use clap::{ArgMatches, Command};
use crate::cli::CuddleCli;
use super::{folder::FolderCommand, kustomize::KustomizeCommand};
pub fn build_command(root_cmd: Command) -> Command {
let cmd = Command::new("render").about("accesses different render commands");
let cmd = super::kustomize::build_command(cmd);
let cmd = super::folder::build_command(cmd);
root_cmd.subcommand(cmd)
}
pub struct RenderCommand {}
impl RenderCommand {
pub fn execute(matches: &ArgMatches, cli: CuddleCli) -> anyhow::Result<()> {
match matches.subcommand() {
Some(("kustomize", sub_matches)) => {
KustomizeCommand::from_matches(sub_matches, cli)?.execute()?;
}
Some(("folder", sub_matches)) => {
FolderCommand::from_matches(sub_matches, cli)?.execute()?;
}
_ => anyhow::bail!("failed to find match for render"),
}
Ok(())
}
}