|
1 | 1 | //! Dispatch for `hm cloud` subcommands. |
2 | 2 |
|
3 | | -use std::collections::BTreeMap; |
4 | | - |
5 | 3 | use anyhow::Result; |
6 | 4 | use hm_cloud::cli::{AuthCommand, CloudCommand}; |
7 | 5 | use hm_core::app_ctx::AppCtx; |
@@ -31,22 +29,18 @@ impl From<ExitCode> for i32 { |
31 | 29 | /// |
32 | 30 | /// Returns an error only if dispatch itself fails; a verb's own runtime |
33 | 31 | /// failure is logged and mapped to a non-zero exit code. |
34 | | -pub async fn dispatch_command( |
35 | | - command: CloudCommand, |
36 | | - env: BTreeMap<String, String>, |
37 | | - app: &AppCtx, |
38 | | -) -> Result<i32> { |
| 32 | +pub async fn dispatch_command(command: CloudCommand, app: &AppCtx) -> Result<i32> { |
39 | 33 | let result = match command { |
40 | 34 | CloudCommand::Auth(cmd) => match cmd { |
41 | 35 | AuthCommand::Login => auth::login::run(app).await, |
42 | 36 | AuthCommand::Logout => auth::logout::run(app).await, |
43 | 37 | AuthCommand::Whoami => auth::whoami::run(app).await, |
44 | 38 | }, |
45 | | - CloudCommand::Org(cmd) => verbs::org::run(&env, cmd, app).await, |
46 | | - CloudCommand::Pipeline(cmd) => verbs::pipeline::run(&env, cmd, app).await, |
47 | | - CloudCommand::Build(cmd) => verbs::build::run(&env, cmd, app).await, |
48 | | - CloudCommand::Job(cmd) => verbs::job::run(&env, cmd, app).await, |
49 | | - CloudCommand::Billing(cmd) => verbs::billing::run(&env, cmd, app).await, |
| 39 | + CloudCommand::Org(cmd) => verbs::org::run(cmd, app).await, |
| 40 | + CloudCommand::Pipeline(cmd) => verbs::pipeline::run(cmd, app).await, |
| 41 | + CloudCommand::Build(cmd) => verbs::build::run(cmd, app).await, |
| 42 | + CloudCommand::Job(cmd) => verbs::job::run(cmd, app).await, |
| 43 | + CloudCommand::Billing(cmd) => verbs::billing::run(cmd, app).await, |
50 | 44 | }; |
51 | 45 | match result { |
52 | 46 | Ok(()) => Ok(ExitCode::Success.into()), |
|
0 commit comments