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.53k stars 81 forks source link

Toml error #178

Closed elibroftw closed 4 months ago

elibroftw commented 5 months ago

python3 -m yq '.workspace[]' Cargo.toml

jq: error (at :1): Cannot index array with string "workspace

[workspace]
resolver = "2"
kislyuk commented 5 months ago

Hello, when you run yq as a python module, it expects YAML. To parse TOML, you have to use the tomlq executable:

tomlq '.workspace[]' Cargo.toml
elibroftw commented 5 months ago

That's really bad for bash scripting and UX. I decided to use dasel instead just for the one case where a toml table is empty. I use the yq package for everything else.

kislyuk commented 5 months ago

PRs and support donations are welcome.