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

Add command line option to ignore blank yaml values #15

Open
jsh2134 opened this issue May 29, 2015 · 1 comment
Open

Add command line option to ignore blank yaml values #15

jsh2134 opened this issue May 29, 2015 · 1 comment

Comments

@jsh2134
Copy link

jsh2134 commented May 29, 2015

It would be great if there was an output flag to ignore blank yaml values. Currently it outputs null

My use case is that I'm using it along with envdir to output a docker-compose file to an envdir directory

the current command:
cat docker-compose.yml | shyaml get-value api.environment | grep -v null | awk -F': ' '{print $2 > ("envdir/" $1)}'

proposed fix would be something like
shyaml get-value api.environment --ignore-blank

via a StackOverflow comment http://stackoverflow.com/questions/5014632/how-can-i-parse-a-yaml-file-from-a-linux-shell-script/15113891?noredirect=1#comment48491233_15113891

@vaab
Copy link
Member

vaab commented Jun 8, 2015

Hi, thanks for your suggestion. Actually, it's probably better to output 'null' only on request. I'm using postgres often, and you can actually set how null value should be outputted and it was usefull for me several times.

As a consequence, I would probably change shyaml to output an empty string for null values, and add a special --display-null-as VALUE options. I'm pretty much busy these days so don't expect an implementation of this right now, and I probably need to think it through a little more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants