Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Lua input #1810

Merged
merged 1 commit into from Oct 3, 2023
Merged

Add support for Lua input #1810

merged 1 commit into from Oct 3, 2023

Conversation

Zash
Copy link
Contributor

@Zash Zash commented Sep 30, 2023

The missing input half of #1700 / #1745

Uses a full blown Lua parser, it will happily while true do --[[ nothing, forever ]] end so best keep away from untrusted input. Be on the lookout for a way to limit this or a more limited parser. 馃槄

Given a sample.lua file of:

return {
        ["country"] = "Australia"; -- this place
        ["cities"] = {
                "Sydney",
                "Melbourne",
                "Brisbane",
                "Perth",
        };
};

then

yq -oy '.' sample.lua

will output

country: Australia
cities:
  - Sydney
  - Melbourne
  - Brisbane
  - Perth

@Zash Zash force-pushed the lua-input branch 5 times, most recently from 7703142 to b84319b Compare October 1, 2023 14:24
@Zash Zash marked this pull request as ready for review October 1, 2023 14:30
@mikefarah mikefarah merged commit 5fa4162 into mikefarah:master Oct 3, 2023
3 checks passed
@mikefarah
Copy link
Owner

Brilliant

@Zash Zash deleted the lua-input branch October 3, 2023 06:09
@Zash Zash mentioned this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants