From 3ccd91a495d13db2a2a7c80e068136de98e60c2a Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 15 Aug 2024 19:26:28 -0700 Subject: [PATCH] cleanup(ctl): move logic for branching ctl run steps into ControlCommands --- crates/ctl/src/cli/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ctl/src/cli/mod.rs b/crates/ctl/src/cli/mod.rs index 8f68ef8..15ecde3 100644 --- a/crates/ctl/src/cli/mod.rs +++ b/crates/ctl/src/cli/mod.rs @@ -43,8 +43,13 @@ impl ControlCommand { pub async fn run(self) -> Result<()> { let client = ControlClientProvider::dial(self.connection.parse()?).await?; let events = EventStream::open(client.clone()).await?; + self.command.run(client, events).await + } +} - match self.command { +impl ControlCommands { + pub async fn run(self, client: ControlServiceClient, events: EventStream) -> Result<()> { + match self { ControlCommands::Zone(zone) => zone.run(client, events).await, ControlCommands::Image(image) => image.run(client, events).await,