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

syntax: add a Quote func #727

Merged
merged 1 commit into from
Sep 12, 2021
Merged

syntax: add a Quote func #727

merged 1 commit into from
Sep 12, 2021

Conversation

mvdan
Copy link
Owner

@mvdan mvdan commented Sep 8, 2021

(see commit message)

@mvdan mvdan force-pushed the syntax-quote branch 3 times, most recently from 2e62dc7 to b169411 Compare September 9, 2021 16:55
Copy link
Collaborator

@andreynering andreynering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems great to me!

Similar to strconv.Quote, but with shell syntax.
See the added godoc for more details.

Unlike strconv.Quote, it needs to return a boolean,
as not all strings can be represented in shell.

With an example to show and test the basics,
as well as a fuzz function to verify edge cases.

Fixes #328.
@mvdan
Copy link
Owner Author

mvdan commented Sep 12, 2021

Thanks for the review! I extended the fuzz func a bit, and it's now incapable of finding cases that we don't handle. In the process I also taught Quote to avoid issues with comments and assignments.

@mvdan mvdan merged commit a137ff0 into master Sep 12, 2021
@mvdan mvdan deleted the syntax-quote branch September 12, 2021 14:09
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 this pull request may close these issues.

2 participants