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
Question on replacing value(s) single and multiple occurrences #23
Comments
Thanks for your interest in dasel! After taking a look at your example file I can tell you that dasel doesn't currently support multiple yaml documents in the same file due to limitations in the yaml package we use: https://github.com/go-yaml/yaml#compatibility If this is a recurring issue I'll look at migrating to a new yaml package. If we assume you have split the documents out into How do I add a line with the namespace value?
Change the namespaceSelector
Notes This does highlight the potential use of multiple files/multiple documents. |
Thanks, in the Kubernetes world a lot of files contains multiple yaml documents, so one command to change every occurence of something is very welcome! |
Hi @ws-way, |
Hi @TomWright , Thanks for adding this, I have read the readme.md and tested it, but it is unclear how I can change all values in an yaml file without knowing how much yaml documents are in there. Do you have an example? |
Dasel is really only designed for use-cases where you know the structure of the files. This sounds like you're after a search + multi-selector feature. A feature request for multi-selector is here: #15 I have thought about adding search functionality but haven't created a feature request for it yet. |
Hello @TomWright , Ok, thanks for the answer! |
As of The following will set the metadata name in all yaml documents to
|
Hi @TomWright , Thanks, I will take a look at this later this week or next week. |
Hello @TomWright , The multiline replace is working fine, thanks. |
Hello,
I was pointed out by someone that this tool was better to replace (multiple) values in a yaml file than using sed. I have tried some examples, but it is not clear to me how to replace certain values in https://raw.githubusercontent.com/c4po/harbor_exporter/master/kubernetes/harbor-exporter.yaml
I need to replace multiple occurrences in this file, however, I am only able to select 1. How do I add a line with the namespace value?
to
Next to this, I also need to replace the value of "- harbor #......" to test and keep the remaining lines and this is failing with dasel put string -f he.yaml -s "spec.namespaceSelector.matchNames" "test"
Thanks!
The text was updated successfully, but these errors were encountered: