Skip to content

Commit 7c310dc

Browse files
committed
feat: add ndcslon output format for forcely colored NDSLON representation
1 parent f723eaa commit 7c310dc

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

data/completion.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ complete:
403403
desc: A NDJSON -new-line delimited JSON- format
404404
- name: out=ndslon
405405
desc: A NDSLON -new-line delimited SLON- format
406+
- name: out=ndcslon
407+
desc: A NDSLON -new-line delimited SLON- forcely colored
406408
- name: out=oaf
407409
desc: Executes OpenAF scripting code or an OpenAF script file and receives -data- as input and outputs via -outoaf-
408410
opts:

data/usage.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@
647647
"Output format": "ndslon",
648648
"Description": "A NDSLON (new-line delimited SLON) format"
649649
},
650+
{
651+
"Output format": "ndcslon",
652+
"Description": "A NDSLON (new-line delimited SLON) format forcely colored"
653+
},
650654
{
651655
"Output format": "openmetrics",
652656
"Description": "Converts a map or list to OpenMetrics/Prometheus compatible format"

src/docs/USAGE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ List of available formats to use with the _output_ option:
200200
| mdyaml | A multi document YAML format (only for list outputs) |
201201
| ndjson | A NDJSON (new-line delimited JSON) format |
202202
| ndslon | A NDSLON (new-line delimited SLON) format |
203+
| ndcslon | A NDSLON (new-line delimited SLON) format forcely colored |
203204
| openmetrics | Converts a map or list to OpenMetrics/Prometheus compatible format |
204205
| oaf | An OpenAF scripting code or OpenAF scripting file (together with 'outoaf') to execute taking input transformed as 'data' |
205206
| pjson | A JSON format with spacing (equivalent to prettyjson) |

src/include/outputFns.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@ var _outputFns = new Map([
296296
_o$o(r, options)
297297
}
298298
}],
299+
["ndcslon", (r, options) => {
300+
if (isArray(r)) {
301+
r.forEach(_r => _print(af.toCSLON(_r)))
302+
} else if (isMap(r)) {
303+
_print(af.toCSLON(r))
304+
} else {
305+
_o$o(r, options)
306+
}
307+
}],
299308
["base64", (r, options) => {
300309
var _o = ""
301310
if (isString(r))

0 commit comments

Comments
 (0)