allenap / shell-quote

A Rust library for shell quoting strings, e.g. for interpolating into a Bash script. This is not as simple as most people think!
Apache License 2.0
5 stars 2 forks source link

bash: don't add leading $ if string is empty #4

Closed kxxt closed 1 year ago

kxxt commented 1 year ago

Hi,

Thanks for your nice work.

The leading $ is added even when the string is empty. We can actually drop the leading $ to make the output more beautiful in this special case.

kxxt commented 1 year ago

I'd change escape_prepare instead though; below is the diff I would like to merge. If you want to update your PR with that I'll merge it. Thank you for putting the energy in to doing this.

Thanks for your quick review. I have applied your diff.

allenap commented 1 year ago

Thanks! I've published 0.3.2 with this change.

Also, sorry, I meant to give you the diff, but I didn't strip out the leading commit stuff from it.