Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted minor refactors and performance nits #519

Merged
merged 5 commits into from
Jan 30, 2024
Merged

Assorted minor refactors and performance nits #519

merged 5 commits into from
Jan 30, 2024

Conversation

vrmiguel
Copy link
Member

@vrmiguel vrmiguel commented Jan 30, 2024

I'm familiaring myself with the tembo-cli code and thought it was a good opportunity to suggest these minor changes

for mut env in context.environment {
if let Some(_is_set) = env.set {
if let Some(profile) = &env.profile {
let credential = profiles.iter().rev().find(|c| &c.name == profile).unwrap();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same idea as the previous code (iterate and find the last matching element) but starting from the end, doing less work overall

@vrmiguel vrmiguel marked this pull request as ready for review January 30, 2024 18:22
@vrmiguel vrmiguel marked this pull request as ready for review January 30, 2024 18:22
Copy link
Contributor

@DarrenBaldwin07 DarrenBaldwin07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean @vrmiguel

@@ -43,7 +43,7 @@ pub fn execute(verbose: bool) -> Result<(), anyhow::Error> {
let mut file_path = FileUtils::get_current_working_dir();
file_path.push_str("/tembo.toml");

let contents = fs::read_to_string(file_path.clone())?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Copy link
Collaborator

@shahadarsh shahadarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Looks good. Just a minor comment on the error msg.

@vrmiguel vrmiguel merged commit 540b530 into main Jan 30, 2024
3 checks passed
@vrmiguel vrmiguel deleted the nits branch January 30, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants