Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh seems to be adding backslashes for unknown reasons #158

Open
louisch opened this issue Jul 30, 2019 · 1 comment
Open

Fresh seems to be adding backslashes for unknown reasons #158

louisch opened this issue Jul 30, 2019 · 1 comment

Comments

@louisch
Copy link

louisch commented Jul 30, 2019

UPDATE: Actually, this seems to be happening with regular fresh invocations in the command line now, I'm not sure what is going on other than there seems to be something wrong with my setup.

When doing something like the following:

❯ find tmux -name '*.yml' -exec fresh {} --file=~/.config/tmuxinator/{} ';'

Either find or fresh seems to escape its input incorrectly because this happens:

Add `fresh tmux/config\.yml \-\-file\=\~/\.config/tmuxinator/tmux/config\.yml` to /home/user/.freshrc [Y/n]? ^C

Dashes, dots, equal signs, and tildes seem to get backslashes added to them. The resulting line won't execute properly as fresh needs --file, not `--file'.

I did try quoting the special characters:

❯ find tmux -name '*.yml' -exec fresh '{} --file=~/.config/tmuxinator/{}' ';'

But this only seemed to make things worse:

Add `fresh tmux/config\.yml\ \-\-file\=\~/\.config/tmuxinator/tmux/config\.yml` to /home/user/.freshrc [Y/n]? ^C
@louisch louisch changed the title Using find -exec with fresh seems to escape certain characters incorrectly Using find -exec with fresh seems to escape certain characters incorrectly Jul 30, 2019
@louisch louisch changed the title Using find -exec with fresh seems to escape certain characters incorrectly Fresh seems to be adding backslashes for unknown reasons Jul 30, 2019
@louisch
Copy link
Author

louisch commented Aug 2, 2019

I suspect it's happening inside the parse_fresh_add_args function which seems to add backslashes before characters in arguments that doesn't match /[A-Za-z_0-9]/, but that still doesn't explain why some of my fresh lines with dots or dashes in them work, and some get escaped.

If I write

fresh tmux/config.yml --file="${HOME}/.config/tmuxinator/config.yml"

inside freshrc it works fine, but if I try to use find -exec like this for example:

find tmux -name '*.yml' -exec sh -c 'fresh {} --file="${HOME}/.config/tmuxinator/$(basename {})"' ';'

It will exhibit the 'dashes and dots get escaped' problem.
Also, if I use fresh on the command line (not inside the freshrc file), any dots and dashes will definitely get escaped in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant