milkey-mouse / edit

Cross-platform Rust library for invoking & waiting for the system text editor
Creative Commons Zero v1.0 Universal
43 stars 8 forks source link

feat: added support for quoted env variables with shell-words #11

Closed insomnimus closed 2 years ago

insomnimus commented 2 years ago

This commit adds a new cargo feature, quoted-env. This pulls in the shell-words dependency.

Normally with the $EDITOR env variable being something like \ 'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession \ will cause an error because the current implementation uses str::split_ascii_whitespace.

With the quoted-env feature enabled, this process is handled by shell_words::split. (On an error, it still falls-back to the original method.)

I've enabled this feature by default, we could change it. I've also not bumped any version, though a minor version bump seems right; let me know if I should do that.

Bug Fixes

Also fixed a clippy lint: clippy::unused_io_amount (The fix was to use write_all instead of just write)

milkey-mouse commented 2 years ago

Now that I see it, this feature was much needed! Thanks!