Open PriceHiller opened 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:
-r NONE
to disable saving and -r filepath
to save to a different file. (This is also how neovim works for its -u
flag).
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 theTOIPE_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 useToipeError
and instead fall back onstd::io::Error
which gets unrolled up where it is then turned intoToipeError
, but in doing so the error information is dropped. See here for thesave_results
function and here for how I'm taking the error in and returningToipeError
.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.