kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.57k stars 82 forks source link

hyphens in yaml break #96

Closed wgroenewald closed 4 years ago

wgroenewald commented 4 years ago

When trying to run yq on a yaml path that has a hyphen in it I get an error: cat file.yml | yq .redis-ha.auth

error:

jq: error: ha/0 is not defined at <top-level>, line 1:
.redis-ha.auth
jq: 1 compile error
yq: Error running jq: IOError: [Errno 32] Broken pipe.

When trying to extract different values without hyphens I get the expected result

kislyuk commented 4 years ago

yq uses jq which uses the Javascript grammar which does not permit hyphens in identifiers. You have to use bracket accessors instead of dot: yq '.["redis-ha"].auth'