feat: scripts can run from plan
This commit is contained in:
@@ -18,10 +18,44 @@ impl ScriptExecutor {
|
||||
}
|
||||
|
||||
pub async fn run(&self, script_ctx: &Script, name: &str) -> anyhow::Result<()> {
|
||||
match script_ctx {
|
||||
Script::Shell {} => ShellExecutor::from(self).execute(name).await?,
|
||||
if self.run_project(script_ctx, name).await? {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if self.run_plan(script_ctx, name).await? {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn run_project(&self, script_ctx: &Script, name: &str) -> anyhow::Result<bool> {
|
||||
match script_ctx {
|
||||
Script::Shell {} => {
|
||||
if matches!(
|
||||
ShellExecutor::from(self).execute(name).await?,
|
||||
shell::ScriptStatus::Found
|
||||
) {
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn run_plan(&self, script_ctx: &Script, name: &str) -> anyhow::Result<bool> {
|
||||
match script_ctx {
|
||||
Script::Shell {} => {
|
||||
if matches!(
|
||||
ShellExecutor::from_plan(self).execute(name).await?,
|
||||
shell::ScriptStatus::Found
|
||||
) {
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user