Working with LUA
Basic input example
Given a sample.lua file of:
return {
["country"] = "Australia"; -- this place
["cities"] = {
"Sydney",
"Melbourne",
"Brisbane",
"Perth",
};
};
then
yq -oy '.' sample.luawill output
country: Australia
cities:
- Sydney
- Melbourne
- Brisbane
- PerthBasic output example
Given a sample.yml file of:
then
will output
Unquoted keys
Uses the --lua-unquoted option to produce a nicer-looking output.
Given a sample.yml file of:
then
will output
Globals
Uses the --lua-globals option to export the values into the global scope.
Given a sample.yml file of:
then
will output
Elaborate example
Given a sample.yml file of:
then
will output
Last updated
Was this helpful?