use clap::Parser;
#[derive(Parser, Clone, PartialEq, Eq, Debug)]
#[command(
name = "cargo-modules",
about = "Print a crate's module tree or graph.",
// after_help = r#"
// If neither `--bin` nor `--example` are given,
// then if the project only has one bin target it will be run.
// Otherwise `--bin` specifies the bin target to run.
// At most one `--bin` can be provided.
// "#
)]
pub enum Command {
#[command(
name = "generate",
about = "Generate a visualization for a crate's structure."
)]
Generate {
#[clap(subcommand)]
cmd: crate::generate::Command,
},
}
impl Command {
pub(crate) fn sanitize(&mut self) {
match self {
Self::Generate { cmd } => cmd.sanitize(),
}
}
pub fn run(&self) -> Result<(), anyhow::Error> {
match self {
Self::Generate { cmd } => cmd.run(),
}
}
}