Skip to content

Commit

Permalink
uses a find with iter() for finding by instance_name for cli (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahadarsh authored Dec 15, 2023
1 parent b2c262d commit 5fbe479
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tembo-cli/src/cmd/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ pub fn get_instance_id(

match v {
Ok(result) => {
for instance in result.iter() {
if instance.instance_name == instance_name {
return Ok(Some(instance.clone().instance_id));
}
let maybe_instance = result
.iter()
.find(|instance| instance.instance_name == instance_name);

if let Some(instance) = maybe_instance {
return Ok(Some(instance.clone().instance_id));
}
}
Err(error) => eprintln!("Error getting instance: {}", error),
Expand Down

0 comments on commit 5fbe479

Please sign in to comment.