aspiers / stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
http://www.gnu.org/s/stow/
GNU General Public License v3.0
589 stars 41 forks source link

Use `shellwords` for `.stowrc` parsing #111

Closed jeremy-code closed 2 weeks ago

jeremy-code commented 3 weeks ago

This change allows .stowrc arguments to be parsed similar to shell arguments, where quotes can be used to group an argument with spaces.

However, this change affects the behavior in --ignore, --defer, --override.

--ignore=\$HOME => (?^:$HOME\z) --defer=\$HOME => (?^:\A$HOME) --override=\$HOME => (?^:\A$HOME)

Hi, this PR is in regards to #15. Other than the tests mentioned (rc_options.t, Test that environment variable expansion is applied. for ignore, defer, and override), everything passes.

I am using shell_words but I also did it with `parse_line(" ", 0, $line) and it had the same effect of breaking that test.

My two concerns are:

  1. The RegEx for the options for that aforementioned test appears to have different behavior than before. I am not certain how to fix this, or whether this is the intended behavior. The current change is just a hack for now.
  2. I added a test but I imagine it is not ideal to have a new folder in tmp-testing-trees for just one test.

Fixes #15.

aspiers commented 3 weeks ago

Awesome, thanks a lot! I think I've fixed the concerns you highlighted now - take a look and let me know what you think?

jeremy-code commented 2 weeks ago

Looks great, thank you so much!