Save Results
This PR closes issue #11.
Summary
This PR adds the ability to save results to a file via the -r flag. In the current implementation results are not saved by default, instead the user must pass either the new -r flag and a path or set the TOIPE_RESULTS_FILE environment variable to a file path.
Notes
The only thing that we might want to modify is the error type being returned by the save_results function I've added. I do not use ToipeError and instead fall back on std::io::Error which gets unrolled up where it is then turned into ToipeError, but in doing so the error information is dropped. See here for the save_results function and here for how I'm taking the error in and returning ToipeError.
Let me know what suggestions you have and I'll be happy to make any relevant modifications. I'm not the biggest Rust guy, so I may have missed more idiomatic patterns that would improve this PR.
Thank you for this @treatybreaker. I haven't been able to find time to review this PR thoroughly, it will take some more time.
Some thoughts though:
- I think the results should be saved by default. With a flag to disable them. Something like
-r NONEto disable saving and-r filepathto save to a different file. (This is also how neovim works for its-uflag). - As for the error handling part, I was moving toipe to use anyhow in #40. I'll update here once that is merged and you can use that.