Skip to content

Add command line option to ignore blank yaml values #15

Description

@jsh2134

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

Activity

  1. vaab commented on Jun 8, 2015

    @vaab
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions