The cee command line
Generate, print, reprint and correct from a terminal or a script, with the cee command.
cee is ceelab’s command line. You call it from a terminal (bash, zsh, PowerShell, cmd) and it fits into your automations. It goes through the same engine as the application, on the same database and the same settings: same checks, same counters, same files, same history.
cee print shipping-label
cee print shipping-label --copies 10
cee print shipping-label --set name="Jane Doe"
cee edit --last --set name="Jane Doe"
shipping-label is the short name of a document type: its key, visible in the Document types tab (Advanced settings › Type key). Templates are designed in the application; the command is there to use them, never to create or modify them.
Installing and calling it
cee ships with ceelab, in the same installer. It works as soon as ceelab has been opened once on the computer. Set the label printer and the output folder in the application before printing.
| System | Location | Calling it |
|---|---|---|
Linux (.deb) |
/usr/bin/cee |
cee … directly. |
| Windows | cee.exe, in the installation folder, next to ceelab.exe |
The installer adds this folder to the user’s PATH; open a new terminal after installing. |
| macOS | /Applications/ceelab.app/Contents/MacOS/cee |
Full path, or see below. |
On macOS, the application is installed by drag and drop, without adding anything to the PATH. To type cee in Terminal, either:
# symbolic link in a folder on the PATH (administrator rights)
sudo ln -s /Applications/ceelab.app/Contents/MacOS/cee /usr/local/bin/cee
# or: application folder at the end of the PATH (~/.zprofile)
export PATH="$PATH:/Applications/ceelab.app/Contents/MacOS"
cee launched from Terminal.Commands
The verbs are in English and the same in every language; the messages follow the application’s language. cee COMMAND --help gives the help for a command; cee print TYPE --help adds the variables of the type.
| Command | Effect |
|---|---|
cee types |
Lists the document types: short name, name and variables to enter. A type with no produced template is flagged “cannot be generated”. |
cee describe TYPE |
Details a type: language, outputs produced, variables to enter (option, kind, required, default value, possible values), then the computed or fixed values. |
cee preview TYPE --out FILE.pdf|.png |
Writes a preview with the given values (PNG at 200 dots per inch). Nothing is reserved, printed or added to the history. --template chooses the template. |
cee print TYPE [variables] [--copies N] [--date YYYY-MM-DD] [--dry-run] |
Generates and prints like the Generation window, for N copies (1 by default, 10,000 at most). |
cee history [--limit N] [--since YYYY-MM-DD] |
Latest generated documents (20 by default), most recent first. |
cee reprint ID|--last [--dry-run] |
Reprints a document from the history exactly as it was, without using up a number. |
cee edit ID|--last VARIABLES [--dry-run] |
Corrects a document and reprints it: same numbers, original layout, corrected values. The correction is a new document, linked to the original. |
--dry-run runs every check of a real print and shows what would be produced, without reserving, writing or printing anything.
cee edit --last with no value corrects nothing: it shows the variables of the latest document and their values (code 2). A correction is refused (code 4) when it would change a value that a formula depends on, or that a template text uses in a calculation ({upper(product)}): generate a new document instead.
Variables of the type
The -- options depend on the type: each entered variable (text, number, date, choice list or Yes/No, asked of the operator) is given by its name or with --set:
cee print product_label --product "Vis inox" --reference VX-0620
cee print product_label --set product="Vis inox" --set reference=VX-0620
- A number may be written with a comma (
12,5); a date asYYYY-MM-DDorDD/MM/YYYY; a choice list expects the exact text of an option; a Yes/No is writtentrueorfalse. - A variable that is not given takes its default value. A number, a combined field or a formula is computed by ceelab: giving one is refused.
- A value containing spaces goes in quotes. The form
--set "name=Jane Doe"works in bash, zsh, PowerShell and cmd.
| Option | Commands | Effect |
|---|---|---|
--json |
all | JSON response on standard output |
--data-dir FOLDER |
all | another data folder (a scheduled task under another account, for example) |
--copies N |
print |
number of copies (1 to 10,000) |
--date YYYY-MM-DD |
print, preview |
earlier document date (never in the future) |
--dry-run |
print, reprint, edit |
simulation, nothing written or printed |
--last |
reprint, edit |
most recent document |
Safeguards
All of them are checked before a single number is reserved:
- Values: required, numbers, dates, choices, Yes/No, date not in the future.
- Typst: the rendering engine must start.
- Label printer set in ceelab, for a type that produces a label.
- Output folder given in full (
/srv/etiquettes,D:\Etiquettes…) for a command that writes a PDF: the initial setting,., is relative and refused. - First-label check: until it has been done in the application, the command prints only one label at a time.
After reservation, a failed output is traced in the history with its number, as in the application; cee reprint ID redoes the document.
The command and the application can work at the same time on the same database: each write waits for the other for up to 5 seconds. After a ceelab update, open the application once before using cee: it is the application that updates the database.
JSON response
With --json, the command writes a single JSON object on standard output, including when there is an error. Common fields: schema (format version), command, ok, code and, on failure, error (kind, message, details). The JSON is ASCII, readable whatever the console’s code page.
# bash: saved values of the document (numbers included)
cee print shipping-label --set "name=Jane Doe" --json | jq '.documents[0].values'
# PowerShell
$r = cee print shipping-label --set "name=Jane Doe" --json | Out-String | ConvertFrom-Json
if ($LASTEXITCODE -ne 0) { throw $r.error.message }
Exit codes
Stable from one version to the next; the name in parentheses is error.kind in JSON.
| Code | Meaning |
|---|---|
| 0 | success (ok) |
| 1 | unexpected error (internal) |
| 2 | incorrect command line, or nothing to correct (usage) |
| 3 | not found: type, document, template (not_found) |
| 4 | data refused (invalid); formula refused (expression) |
| 5 | reserved, not used yet |
| 6 | ceelab not ready on this computer: open it once; or relative output folder (not_configured) |
| 7 | no label printer set (printer) |
| 8 | incomplete generation: at least one failed output, traced and reprintable (partial) |
| 9 | database busy for more than 5 s, or a restore in progress: try again (busy) |
| 10 | Typst not found or unusable (typst) |
| 11 | refused by a safeguard: first-label check not done yet (guard) |
Log
Each call adds a line to the application log (Log tab), prefixed [cee]: command, targeted type or document, names of the variables given (never their values), exit code and duration.