feat: add rust actions
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -6,6 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use cuddle_please_actions::Actions;
|
||||
use cuddle_please_frontend::{gatheres::ConfigArgs, PleaseConfig, PleaseConfigBuilder};
|
||||
use cuddle_please_misc::{
|
||||
ConsoleUi, DynRemoteGitClient, DynUi, GiteaClient, GlobalArgs, LocalGitClient, StdinFn,
|
||||
@@ -92,16 +93,16 @@ impl Command {
|
||||
pub fn execute(self, current_dir: Option<&Path>) -> anyhow::Result<()> {
|
||||
match &self.commands {
|
||||
Some(Commands::Release {}) => {
|
||||
let (config, git_client, gitea_client) = self.get_deps(current_dir)?;
|
||||
ReleaseCommandHandler::new(self.ui, config, git_client, gitea_client)
|
||||
let (config, git_client, gitea_client, actions) = self.get_deps(current_dir)?;
|
||||
ReleaseCommandHandler::new(self.ui, config, git_client, gitea_client, actions)
|
||||
.execute(self.global.dry_run)?;
|
||||
}
|
||||
Some(Commands::Config { command }) => {
|
||||
let (config, _, _) = self.get_deps(current_dir)?;
|
||||
let (config, _, _, _) = self.get_deps(current_dir)?;
|
||||
ConfigCommandHandler::new(self.ui, config).execute(command)?;
|
||||
}
|
||||
Some(Commands::Gitea { command }) => {
|
||||
let (config, _, gitea_client) = self.get_deps(current_dir)?;
|
||||
let (config, _, gitea_client, _) = self.get_deps(current_dir)?;
|
||||
|
||||
GiteaCommandHandler::new(self.ui, config, gitea_client)
|
||||
.execute(command, self.global.token.expect("token to be set").deref())?;
|
||||
@@ -118,7 +119,7 @@ impl Command {
|
||||
fn get_deps(
|
||||
&self,
|
||||
current_dir: Option<&Path>,
|
||||
) -> anyhow::Result<(PleaseConfig, VcsClient, DynRemoteGitClient)> {
|
||||
) -> anyhow::Result<(PleaseConfig, VcsClient, DynRemoteGitClient, Actions)> {
|
||||
let config = self.build_config(current_dir)?;
|
||||
let git_client =
|
||||
self.get_git(&config, self.global.token.clone().expect("token to be set"))?;
|
||||
@@ -140,7 +141,9 @@ impl Command {
|
||||
tracing_subscriber::fmt().with_env_filter(env_filter).init();
|
||||
}
|
||||
|
||||
Ok((config, git_client, gitea_client))
|
||||
let actions = self.get_actions()?;
|
||||
|
||||
Ok((config, git_client, gitea_client, actions))
|
||||
}
|
||||
|
||||
fn build_config(&self, current_dir: Option<&Path>) -> Result<PleaseConfig, anyhow::Error> {
|
||||
@@ -183,6 +186,10 @@ impl Command {
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_actions(&self) -> anyhow::Result<Actions> {
|
||||
Actions::from_cuddle()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Subcommand)]
|
||||
|
Reference in New Issue
Block a user