Add support for quoted patterns in Host#37
Open
mntnorv wants to merge 1 commit intokevinburke:masterfrom
Open
Conversation
kevinburke
reviewed
Jan 26, 2022
| // String prints the string representation of the pattern. | ||
| func (p Pattern) String() string { | ||
| if p.hasWhitespace { | ||
| return fmt.Sprintf("\"%s\"", p.str) |
Owner
There was a problem hiding this comment.
should we do fmt.Sprintf("%q") here?
Author
There was a problem hiding this comment.
I don't think so. String() must return a representation that would work in an actual SSH config file, but %q escapes characters like ", \n, \r, \t. And the pattern string:
- cannot contain
", because of the logic inparseSSHArguments; - cannot contain
\n,\r, because of how the lexer parses a config; - can contain
\t(and probably other characters that%qwould escape), but they must be left as-is, as they are not escaped in an SSH config.
Author
|
@kevinburke Hey could you review the PR? This has been standing for a long time. I fixed the conflicts that appeared with the 1.2 release. |
Owner
|
Sorry - I don't get paid to maintain this library and need to prioritize paid work. If you need this feature for your work please reach out about a support contract - there's information in the README. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SSH supports Host patterns with spaces between double quotes, like the following:
Add support for parsing and serializing such patterns.