command-line Lua table processor (lq is for Lua what jq is for JSON)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
lq-0.0.2-1.rockspec
lq.lua

README.md

lq

command-line Lua table processor (similar to jq)

Usage example

return {
  field = {
    number = 1,
    string = "str",
  },
  advanced = {
    { a = 1, b = 2, },
    { a = 3, b = 4, c = 11, },
    { a = 5, b = 6, },
  },
}
# lq .field.number input.lua
1
# lq '.field | keys' input.lua
number
string
# lq '.field | values' input.lua
1
str
# lq '.field.[]' input.lua
1
str
# lq '.advanced.[] | filter(.a == 1) | .b?'
2
# lq '.advanced.[] | (if has("c") then [.b] else [1,2] end)'
{
  1,
  2
}
{
  4
}
{
  1,
  2
}

Install

Run luarocks install lq or check-out this repository and run luarocks make.