nkb emit
Print the values of a pack for a script or a test file, as JSON, CSV or one value per line.
nkb emit <pack> [--format json|csv|lines] [--escaped|--raw] [--base64]
What does it print?
Values, on standard output, and nothing else. The account of what came out, and any note about what a format could not carry, goes to standard error, so a file you redirect into holds values only. A pack with an error is not printed at all: a pack is whole or absent.
Examples
One value per line, for a test that reads a text file:
$ nkb emit magic-values --format lines > magic-values.txt
nkb emit: 12 values, 47 code points, 47 bytes
$ head -4 magic-values.txt
no
null
true
NaN
JSON, the default, carries every field of every value and both of its forms, the value itself and the value escaped:
$ nkb emit locale-pl
{
"schema": 1,
"values": [
{
"pack": "locale-pl",
"ref": "locale-pl/pesel-valid",
"id": "pesel-valid",
"name": "PESEL with a valid checksum",
"value": "99023012343",
"escaped": "99023012343",
CSV, one row per value, escaped by default, because this catalogue holds values that destroy CSV files:
$ nkb emit dates-impossible --format csv
nkb emit: 12 values, 111 code points, 111 bytes
pack,ref,id,name,value,breaks,expect,fields,tags,risk,since,source,generated
dates-impossible,dates-impossible/feb-30,feb-30,30 February,30.02.2026,...
Which form should I ask for?
The escaped form writes a character nobody can see as its escape, the way a pack file stores it, so a reviewer can read it and a file survives an editor. The raw form writes the value itself, which is what a test should feed to the application. --escaped and --raw choose one of the two, and asking for both is refused rather than settled quietly. --base64 encodes every value for a channel that would damage text, such as a shell variable or an environment that rewrites line endings.
lines refuses a value that contains a line break, by name, rather than splitting it into two lines silently.
Options
Formats
Exit codes
This command's help names no exit codes of its own. The numbers mean the same for every command: Exit codes
The help, as the program prints it
What nkb emit --help prints, from nkb 0.1.0.
nkb emit - print a pack's values for a script or a file
Usage:
nkb emit <pack> [--format json|csv|lines] [--escaped|--raw] [--base64]
Values go to standard output. The account of what came out, and any
note about what a format could not carry, go to standard error - so a
redirected file holds values and nothing else.
Formats:
json Both forms of every value, and every field. The default,
because it is the only one that carries the whole catalogue
csv One row per value. Escaped by default, because this
catalogue contains values that destroy CSV files
lines One value per line. Refuses a value containing a line
break by name, rather than splitting it silently
Options:
--escaped Print values as a pack file stores them
--raw Print values literally
--base64 Encode values, for channels that damage text
-h, --help Show this help and exit with 0