cleanup(ctl): move logic for branching ctl run steps into ControlCommands (#342)

This commit is contained in:
Alex Zenla 2024-08-15 19:32:30 -07:00 committed by GitHub
parent 1d75dfb88a
commit 6093627bdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<Channel>, events: EventStream) -> Result<()> {
match self {
ControlCommands::Zone(zone) => zone.run(client, events).await,
ControlCommands::Image(image) => image.run(client, events).await,