Skip to content

Conversation

ashupednekar
Copy link
Contributor

  • instead of unwrapping on get_username result, propagating the error properly to main so that it gracefully fails instead of panicking

fn check_config_exists() -> bool {
fs::metadata(get_config_file_name()).is_ok()
fn check_config_exists() -> Result<bool> {
Ok(fs::metadata(get_config_file_name()).is_ok())
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this necessary if Ok is returned always?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just to propagate the error from create config all the way to main, so it doesn't panic

Also, in the future there's value in adding a proper cli library like clap

@amritghimire
Copy link
Owner

Can you fix the rust fmt?

@ashupednekar
Copy link
Contributor Author

Can you fix the rust fmt?
done 👍

@amritghimire amritghimire merged commit 383546e into amritghimire:main Oct 9, 2024
13 checks passed
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.

2 participants