-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Option to avoid spaces in generated properties #1864
Comments
yq uses https://github.com/magiconair/properties to decode/encode property files and it currently does not expose an interface to let me control the whitespace. For now, you could do a custom format, I've just added a new recipe to show how: https://mikefarah.gitbook.io/yq/recipes#export-as-environment-variables-script-or-any-custom-format. That said, you're |
It's not apparent from the recipe how to handle lists to output them like the Besides the recipe doesn't work as described in #1932 |
Also I don't think this recipe approach will ever be able to handle comments |
I guess it could after all, but the recipe gets really complex :( |
This commit adds the --properties-separator option, which lets users specify the separator used between keys and values in the properties output format. This is done by adjusting the value of github.com/magiconair/properties#Properties.WriteSeparator at encode time. Some refactoring of the properties encoder unit tests was done to make it easier to write unit tests that include different separator values. Fixes: mikefarah#1864 Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
This commit adds the --properties-separator option, which lets users specify the separator used between keys and values in the properties output format. This is done by adjusting the value of github.com/magiconair/properties#Properties.WriteSeparator at encode time. Some refactoring of the properties encoder unit tests was done to make it easier to write unit tests that include different separator values. Fixes: mikefarah#1864 Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
This commit adds the --properties-separator option, which lets users specify the separator used between keys and values in the properties output format. This is done by adjusting the value of github.com/magiconair/properties#Properties.WriteSeparator at encode time. Some refactoring of the properties encoder unit tests was done to make it easier to write unit tests that include different separator values. Fixes: #1864 Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
Fixed in 4.42.1 |
Please describe your feature request.
Currently, when the output is formatted as properties, the equality signs are separated by a single space from both keys and values. Kustomize supports properties files. However, it is not able to process them if they have such whitespace around the equality characters.
I'd like to be able to instruct yq to generate a more compact properties format that is compatible with Kustomize.
A clear and concise description of what the request is and what it would solve.
Describe the solution you'd like
Given a file application.properties:
foo=bar
And we run a command:
yq --no-spaces '.baz="nix"' application.properties
it could output
Describe alternatives you've considered
At the moment, I use sed to remove the whitespace:
The text was updated successfully, but these errors were encountered: