jsq: new ptrcport

This commit is contained in:
ptrcnull 2022-05-07 22:57:33 +02:00
parent 3f23af4285
commit 8f656f1623
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA
2 changed files with 31 additions and 0 deletions

20
jsq/APKBUILD Normal file
View file

@ -0,0 +1,20 @@
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
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
"

11
jsq/jsq Normal file
View file

@ -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)
}
"