Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== sq [[toc:]] sq is a [[https://github.com/stedolan/jq|jq]] wrapper for S-expressions. Specifically, it round-trips [[https://srfi.schemers.org/srfi-180/srfi-180.html|SRFI-180]]-formatted inputs through jq, allowing you to use that program's filters and flags to manipulate Scheme data. Think of it like [[https://github.com/kislyuk/yq|yq]], but for S-expressions instead of YAML. == Links * Sources: [[https://hg.sr.ht/~evhan/sq]] * Issues: [[https://todo.sr.ht/~evhan/sq]] == Installation Use your distribution's package manager to install [[https://code.call-cc.org/|CHICKEN 5.2]] or newer, then run: <enscript highlight="sh"> chicken-install sq </enscript> Because sq calls jq internally, you will also need to install jq according to the [[https://stedolan.github.io/jq/download/|download instructions]] for your platform. == Usage Invoke sq just like you would jq. It accepts either S-expressions or JSON as input. When S-expressions are used, they must follow the format described by [[https://srfi.schemers.org/srfi-180/srfi-180.html|SRFI-180]], for which the mapping between JSON types and Scheme objects is the following: * {{null}} → the symbol {{null}} * {{true}} → {{#t}} * {{false}} → {{#f}} * number → number * string → string * array → vector * object → association list with keys that are symbols By default, sq generates S-expressions: <enscript highlight="sh"> $ echo '{"greeting": "hello"}' | sq ((greeting . "hello")) $ echo '((greeting . "hello"))' | sq ((greeting . "hello")) </enscript> To generate JSON instead, pass the {{-j}} or {{--json}} flag: <enscript highlight="sh"> $ echo '{"greeting": "hello"}' | sq --json { "greeting": "hello" } $ echo '((greeting . "hello"))' | sq --json { "greeting": "hello" } </enscript> Any other flags (apart from {{--help}} and {{--version}}) are passed directly through to jq. For example, use the {{-r}} or {{--raw-output}} flag to output string values: <enscript highlight="sh"> $ echo '{"greeting": "hello"}' | sq --raw-output .greeting hello $ echo '((greeting . "hello"))' | sq --raw-output .greeting hello </enscript> Note that not all flags will work with sq. For example, the {{--color-output}} flag will only work when combined with {{--json}}, and the {{--null-input}} flag is obviously useless since sq works by sending input to jq. === Known Problems * Parsing is slow for large JSON outputs generated by jq. * The program should probably just execute jq when {{--json}} is used with JSON inputs. * There is no validation of command line flags for compatibility. * Error messages for invalid S-expression inputs are not very helpful. * Inputs must be entirely in one format, you cannot mix JSON and S-expressions. * It is not currently possible to specify the format of the input. == License This software is provided under the terms of the 3-clause BSD license. The SRFI-180 implementation is Copyright © Amirouche Boubekki.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 2 by 5?