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

Enh/blank startup #126

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Jeremy-Code-F
Copy link

@Jeremy-Code-F Jeremy-Code-F commented Jan 22, 2023

Description

Handles default initialization for an empty environment (never used effitask or todo.sh before)

Checklist

  • All tests are passing
  • New tests were created to address changes in pr (and tests are passing)
  • Updated README and/or documentation, if necessary

Thanks for contributing!

Copy link
Owner

@sanpii sanpii left a comment

Choose a reason for hiding this comment

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

Thank you for this PR, it’s a good idea.

.vscode/launch.json Outdated Show resolved Hide resolved
src/application/environment.rs Outdated Show resolved Hide resolved
src/application/environment.rs Outdated Show resolved Hide resolved
src/application/environment.rs Outdated Show resolved Hide resolved
match std::fs::File::create(file_path){
Ok(_) => {},
Err(err) => {
log::error!("Unable to create {} because {}",file_path, err);
Copy link
Owner

Choose a reason for hiding this comment

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

Errors shouldn’t be treated here but reported to caller.

Copy link
Author

Choose a reason for hiding this comment

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

I am reporting these errors back up with a Result<(), std::io::Error> to the Environment constructor now, and the constructor logs an error if there are any initialization problems. I'll hold off on resolving this in case we need to bubble this up any further

Copy link
Owner

Choose a reason for hiding this comment

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

The constructor can return a Result and let the main function deals with error.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback, will work on this when I get a chance...if it were to return an Error to the caller in main() should we panic at that point? Or is there someway to recover from this (fallback todo.txt and done.txt for example)?

Copy link
Author

Choose a reason for hiding this comment

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

Unwrapping this in main, let me know your thoughts though

src/application/mod.rs Outdated Show resolved Hide resolved
src/application/widget.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/application/environment.rs Outdated Show resolved Hide resolved
chewy added 6 commits January 23, 2023 17:50
…ntialization now returns a Result so the caller can decide how to handle errors
… case of issues accessing todo.txt and done.txt
… can be accessed from main, removed new from update_tasks function, app now uses one instance of Environment for everything
src/application/env.rs Outdated Show resolved Hide resolved
Jeremy Farmer added 3 commits January 25, 2023 15:12
Environment constructor now returns a Result so the caller can handle
initialization issues
…le is already set to something non-default
src/application/env.rs Outdated Show resolved Hide resolved
src/widgets/tasks.rs Outdated Show resolved Hide resolved
src/application/widget.rs Outdated Show resolved Hide resolved
src/application/env.rs Show resolved Hide resolved
@@ -18,6 +18,8 @@ regex = "^1.0"
relm = "0.24"
relm-derive = "0.24"
xdg = "2.1"
dirs = "4.0.0"
mktemp = "0.5.0"
Copy link
Owner

Choose a reason for hiding this comment

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

You should add dev dependencies in the [dev-depedencies] section.

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.

None yet

2 participants