use crate::command::cloud::CloudSubcommand;
use crate::command_handler::Handlers;
use crate::context::Context;
use std::sync::Arc;
pub mod account;
pub mod project;
pub mod token;
pub struct CloudCommandHandler {
ctx: Arc<Context>,
}
impl CloudCommandHandler {
pub fn new(ctx: Arc<Context>) -> Self {
Self { ctx }
}
pub async fn handle_command(&self, subcommand: CloudSubcommand) -> anyhow::Result<()> {
match subcommand {
CloudSubcommand::Project { subcommand } => {
self.ctx
.cloud_project_handler()
.handle_command(subcommand)
.await
}
CloudSubcommand::Account { subcommand } => {
self.ctx
.cloud_account_handler()
.handle_command(subcommand)
.await
}
CloudSubcommand::Token { subcommand } => {
self.ctx
.cloud_token_handler()
.handle_command(subcommand)
.await
}
}
}
}