libjq-go icon indicating copy to clipboard operation
libjq-go copied to clipboard

Define jq libs as strings

Open diafour opened this issue 5 years ago • 0 comments

jq can find all *.jq files in the directory specified by WithLibPath and then methods from these libraries can be used in the program. It will be useful if such libraries can be defined from strings.

libText := `
def camel:
  gsub("-(?<a>[a-z])"; .a|ascii_upcase);
`
Jq().WithLibrary("methods", libText).Program(`include "methods"; .foo | camel`).Run()

diafour avatar Jan 29 '20 18:01 diafour