Rewrite rust (#38)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Co-authored-by: kjuulh <contact@kjuulh.io>
Reviewed-on: https://git.front.kjuulh.io/kjuulh/octopush/pulls/38
This commit is contained in:
2022-11-27 11:21:35 +00:00
parent 0d6e8bc4a0
commit 991861db99
445 changed files with 53358 additions and 2568 deletions

View File

@@ -0,0 +1,39 @@
mod commands;
use clap::Command;
const VERSION: &str = "1.0.0";
#[derive(Debug)]
pub struct OctopushCli {
cmd: clap::Command,
}
impl OctopushCli {
pub fn new() -> Self {
let cmd = Command::new("octopush")
.version(VERSION)
.author("Kasper J. Hermansen <contact@kjuulh.io>")
.about("Your cute action executor")
.propagate_version(true)
.subcommand_required(true)
.subcommand(commands::execute::execute_cmd());
Self { cmd }
}
pub async fn execute(self) -> eyre::Result<()> {
let matches = self.cmd.get_matches();
match matches.subcommand() {
Some(("execute", execute_sub)) => {
tracing::debug!("executing subcommand 'execute'");
commands::execute::execute_subcommand(execute_sub).await?;
}
Some(_) => return Err(eyre::anyhow!("unknown subcommand, please see --help")),
None => return Err(eyre::anyhow!("no subcommand specified")),
}
Ok(())
}
}