use crate::version;
use anyhow::Result;
use clap::{Parser, Subcommand};
mod module;
#[derive(Parser)]
#[command(name = "cdk-ansible", author, long_version = version::version().to_string())]
#[command(about = ".")]
#[command(propagate_version = true)]
#[command(
after_help = "Use `cdk-ansible help` for more details.",
after_long_help = "",
// disable_help_flag = true,
// disable_help_subcommand = true,
disable_version_flag = true
)]
pub struct Cli {
#[command(subcommand)]
pub command: Box<Commands>,
#[command(flatten)]
pub top_level: TopLevelArgs,
}
impl Cli {
pub async fn run(args: Vec<String>) -> Result<()> {
let cli = Self::parse_from(args);
match *cli.command {
Commands::Module(cmd) => cmd.run().await,
}
}
}
#[derive(Parser)]
#[command(disable_version_flag = true)]
pub struct TopLevelArgs {
#[arg(global = true, short = 'V', long, action = clap::ArgAction::Version)]
pub version: Option<bool>,
}
#[derive(Subcommand)]
pub enum Commands {
#[command(verbatim_doc_comment)]
Module(module::ModuleCmd),
}