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

Using '---' as value gives an error #101

Closed
ghost opened this issue Mar 6, 2021 · 2 comments
Closed

Using '---' as value gives an error #101

ghost opened this issue Mar 6, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Mar 6, 2021

Hello,

With 1.13.3 I do a

echo '' | dasel put string -p yaml 'extraEnv.[0].name' 'KEYCLOAK_STATISTICS' |
dasel put string -p yaml 'extraEnv.[0].value' 'ALL' |
dasel put string -p yaml 'extraEnv.[1].name' 'KEYCLOAK_USER' |
dasel put string -p yaml 'extraEnv.[1].value' 'admin' |
dasel put string -p yaml 'extraEnv.[2].name' 'KEYCLOAK_PASSWORD' |
dasel put string -p yaml 'extraEnv.[2].value' '---keycloak-password---'

which gives a 'Error: bad flag syntax: ---keycloak-password---'.

Is there anyway I can start a string with '---' ?

Thanks.

@ghost ghost added the bug Something isn't working label Mar 6, 2021
@TomWright
Copy link
Owner

I've found that you're facing this issue because of the flag parser being used: https://github.com/spf13/pflag/blob/85dd5c8bc61cfa382fecd072378089d4e856579d/flag.go#L962

I can look into a workaround/fix for this but since it's outside of my control I can suggest an alternative approach using put document for the meantime:

echo 'extraEnv:
- name: KEYCLOAK_STATISTICS
  value: ALL
- name: KEYCLOAK_USER
  value: admin' | ./dasel put document -p yaml 'extraEnv.[2]' -d yaml '
name: KEYCLOAK_PASSWORD
password: ---keycloak-password---
'

@ghost
Copy link
Author

ghost commented Mar 7, 2021

Ok, thanks, this will do

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant