Yq: Dots in variable name

Created on 4 Sep 2017  路  4Comments  路  Source: mikefarah/yq

This script doesnt work for:

# parameters.yml
parameters:
  database.name: app
$ yaml read parameters.yml parameters.database.name
null

I think this is valid yaml.
Am I missing something?

bug

Most helpful comment

The following workaround works in current build FYI:

yaml r ~/parameters.yml parameters[database.name]

All 4 comments

Ouch! No you're quite right, this won't handle dots in the name at the moment.

To fix this we'd need to add some escaping in the path name.

The following workaround works in current build FYI:

yaml r ~/parameters.yml parameters[database.name]

I think the approach show by @bubbleattic is probably the best approach. Otherwise I'm not sure how it would be possible to know if the intent by the user. The key lookup indicator [key] allows the user provide their intent and it will work regardless what format is used for any key.

If agreed, we can just update the docs accordingly.

Great find! I actually think that's better than escaping anyway :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

infa-ddeore picture infa-ddeore  路  5Comments

rgm3 picture rgm3  路  7Comments

dakky picture dakky  路  5Comments

tadayosi picture tadayosi  路  6Comments

tamalsaha picture tamalsaha  路  5Comments