From 8f656f162323f3f31aecc62b27c884819692876a Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Sat, 7 May 2022 22:57:33 +0200 Subject: [PATCH] jsq: new ptrcport --- jsq/APKBUILD | 20 ++++++++++++++++++++ jsq/jsq | 11 +++++++++++ 2 files changed, 31 insertions(+) create mode 100644 jsq/APKBUILD create mode 100644 jsq/jsq diff --git a/jsq/APKBUILD b/jsq/APKBUILD new file mode 100644 index 0000000..63c948b --- /dev/null +++ b/jsq/APKBUILD @@ -0,0 +1,20 @@ +# Contributor: Patrycja Rosa +# Maintainer: Patrycja Rosa +pkgname=jsq +pkgver=1 +pkgrel=0 +pkgdesc="QuickJS-based jq-like data processing tool" +url="https://git.ddd.rip/ptrcnull/ptrcports" +arch="noarch" +license="BSD-2-Clause" +depends="quickjs" +source="jsq" +builddir="$srcdir" +options="!check" # nice + +package() { + install -Dm755 jsq -t "$pkgdir"/usr/bin +} +sha512sums=" +a1404bb221f1b42efcba3973fca5aff4525b0e0e37b32f5a53f57eeb2eae5a90d419c7434e9a7818c96c79e0d96b5be2d80dc2af8e7bc38344b9b8d5b7590e46 jsq +" diff --git a/jsq/jsq b/jsq/jsq new file mode 100644 index 0000000..abeda75 --- /dev/null +++ b/jsq/jsq @@ -0,0 +1,11 @@ +#!/bin/sh + +exec qjs --std -e " + var input = JSON.parse(std.in.readAsString()) + var output = input$@; + if (typeof output === 'object') { + console.log(JSON.stringify(output, null, 2)) + } else { + console.log(output) + } +"