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

Spaces in variables produce errors. #24

Open
magpie514 opened this issue May 22, 2019 · 4 comments · May be fixed by #28
Open

Spaces in variables produce errors. #24

magpie514 opened this issue May 22, 2019 · 4 comments · May be fixed by #28

Comments

@magpie514
Copy link

magpie514 commented May 22, 2019

I was testing out cookie to see what I could do with it and after a few tests I accidentally left a variable name with spaces which caused a bad substitution error.
'''

Initializing the './/doc.sh' script.
DATE:
/home/magpie/.local/bin/cookie: line 384: ${{Script Name}}: bad substitution
{{Script Name}}:
'''

This is in Ubuntu 19.04, bash 5.0.3, and current master for cookie.
While it's not unusual for variables to require no spaces it'd be good to have a failsafe in place.

@magpie514 magpie514 changed the title Empty variable field produces an error. Spaces in variables produce errors. May 22, 2019
@bbugyi200
Copy link
Owner

bbugyi200 commented Jun 1, 2019

@magpie514 Thanks for submitting this. While not an unreasonable request by any means, I don't personally agree with this. I think it falls into the category of trying to catch an exception that you can't really handle. Moreover, a slightly better error message doesn't warrant the added complexity in my opinion.

@magpie514
Copy link
Author

Fair enough. It was meant less as a request and more of a potential area of error (after all I triggered it by mistake, I was meaning to input a _ but fumbled it somehow), but I find it's a reasonable decision since it shouldn't happen unless there's user error.

@hardyoyo
Copy link

hardyoyo commented Jan 9, 2022

This is most definitely still a bug, even if the suggested solution wasn't satisfactory. I have encountered the same bug (it's rather easy, just enter more than one word for any template value). I have a pull request ready which will fix this bug. I will check the contributing docs first to see if you require issues be submitted before pull requests.

hardyoyo added a commit to hardyoyo/cookie that referenced this issue Jan 9, 2022
Allows templates to handle variables with spaces in them, by wrapping
values with quotes. Fixes bbugyi200#24.
@hardyoyo hardyoyo linked a pull request Jan 9, 2022 that will close this issue
@bbugyi200
Copy link
Owner

Reopening this issue until I have time to test #28.

@bbugyi200 bbugyi200 reopened this Jan 10, 2022
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

Successfully merging a pull request may close this issue.

3 participants