dagger-rs/src/cli.rs

23 lines
558 B
Rust
Raw Normal View History

2023-01-27 08:31:09 +01:00
pub struct Cli {
cmd: clap::Command,
}
impl Cli {
pub fn new() -> eyre::Result<Self> {
Ok(Self {
cmd: clap::Command::new("dagger-rust")
.subcommand_required(true)
.subcommand(clap::Command::new("generate")),
})
}
pub fn execute(self, args: &[&str]) -> eyre::Result<()> {
let matches = self.cmd.get_matches_from(args);
match matches.subcommand() {
2023-01-27 08:32:40 +01:00
Some(("generate", _args)) => Ok(()),
2023-01-27 08:31:09 +01:00
_ => eyre::bail!("command missing"),
}
}
}