treek

Treek, like awk but for tree input. Take JSON or TOML or some other tree like input format and run code on bits of it.
git clone http://shtanton.xyz/git/repo/treek
Log | Files | Refs | README

commit 3e39549231249ace1bb886aa8b70345c5febca1d
parent 7434dc0a910c128ff75256f31142146c8f2f7784
Author: Charlie Stanton <charlie@shtanton.xyz>
Date:   Wed, 17 Aug 2022 14:50:07 +0100

Add basic README

Diffstat:
AREADME.md | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -0,0 +1,24 @@ +# treek + +Like awk but for trees. + +Currently supports only JSON. + +Currently implemented in go but once the spec is final I'll reimplement in C or something. + +# Examples + +#### Extract a value +``` +treek "path.to.value" +``` + +#### Print full names of all people +``` +treek 'people.* {println($0.first_name + " " + $0.last_name)}' +``` + +#### Print average age of all people +``` +treek 'people.*.age {total += $0; count += 1} {println(total / count)}' +```