Samyak2 / toipe

yet another typing test, but crab flavoured
MIT License
596 stars 31 forks source link

Save Results #43

Open PriceHiller opened 2 years ago

PriceHiller commented 2 years ago

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.

Samyak2 commented 2 years ago

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: