Add jq
This commit is contained in:
@@ -43,6 +43,7 @@ const POSIX_TITLE = {
|
||||
help: 'Bare OS help summary',
|
||||
hostname: 'set or print hostname',
|
||||
id: 'return user identity',
|
||||
jq: 'command-line JSON processor (jq language subset)',
|
||||
ln: 'link files',
|
||||
login: 'begin a session on the system',
|
||||
logout: 'end session (save vault)',
|
||||
@@ -496,6 +497,36 @@ EXTRA.find = {
|
||||
keywords: ['find', 'directory', 'walk', 'search'],
|
||||
bareOsNotes: 'Expression syntax is a simplified subset.'
|
||||
}
|
||||
EXTRA.jq = {
|
||||
synopsis: [
|
||||
'jq [-n] [-R] [-s] [-c] [-r] [-e] [-f file] filter [file...]',
|
||||
'jq reads JSON (concatenated values or NDJSON-style streams) from files or stdin.'
|
||||
],
|
||||
description:
|
||||
'Runs a jq filter program against JSON values. The engine is vendored jqjs (pure JavaScript), not the C implementation at https://github.com/jqlang/jq — language coverage and edge cases differ.',
|
||||
options: [
|
||||
{ flag: '-n, --null-input', meaning: 'Use null as the sole input (ignore file/stdin for input)' },
|
||||
{ flag: '-R, --raw-input', meaning: 'Treat each line as a string instead of JSON' },
|
||||
{ flag: '-s, --slurp', meaning: 'Read all inputs into one array; run the filter once' },
|
||||
{ flag: '-c, --compact-output', meaning: 'Compact JSON on output' },
|
||||
{ flag: '-r, --raw-output', meaning: 'Print strings without JSON quotes' },
|
||||
{ flag: '-e, --exit-status', meaning: 'Set exit status from outputs (no output → 4; last false/null → 1)' },
|
||||
{ flag: '-f, --from-file', meaning: 'Read filter program from file' }
|
||||
],
|
||||
keywords: ['jq', 'json', 'query', 'filter', 'jqjs'],
|
||||
seeAlso: [
|
||||
{ name: 'grep', section: 1 },
|
||||
{ name: 'awk', section: 1 }
|
||||
],
|
||||
bareOsNotes:
|
||||
'Engine: lib/jq-engine.js from @sscots/jqjs (mwh/jqjs). Missing vs C jq: try/catch, user-defined functions, recurse, many builtins, modules, full Unicode. See upstream jqjs README for the feature matrix.',
|
||||
examples: [
|
||||
{ caption: 'pretty-print', code: 'jq . data.json' },
|
||||
{ caption: 'field', code: 'jq .version package.json' },
|
||||
{ caption: 'slurp array', code: 'jq -s \'map(.x) | add\' parts.jsonl' },
|
||||
{ caption: 'compact', code: 'jq -c \'.[] | select(.ok)\' items.json' }
|
||||
]
|
||||
}
|
||||
EXTRA.login = {
|
||||
description:
|
||||
'When invoked from /bin, behavior aligns with session identity hooks (see booter). Prefer the shell builtin for passphrase entry.',
|
||||
|
||||
Reference in New Issue
Block a user