# Command line This page lists every way to run the UJN module today: draw a journey, write its model, and fill its unique ids. **Not public yet.** There is no public build of the module yet, and no public repository. Every command on this page needs a build of PlantUML with the UJN module: the project's local build, or the test build invited testers get through the assistant setup on the Goodies page. A Mermaid extension is planned. ## Draw a journey Local build only: ```text java -jar plantuml.jar -tsvg checkout.puml java -jar plantuml.jar -tpng checkout.puml ``` - The module draws through PlantUML, so the formats are PlantUML's (19.7). - Use `-tsvg`: it keeps the text as text. `-tpng` gives a PNG. - PlantUML names and places the drawing as it does for its other diagrams. ## Write the model Local build only: ```text java -jar plantuml.jar -tsvg --ujn-model checkout.puml ``` - `--ujn-model`, or its alias `-ujn_model`, writes the model beside the diagram file as `.ujn.json`, here `checkout.ujn.json` (section 20). - The model is a separate JSON file for tools: every node and arrow with its meaning worked out, and every warning. The model schema, version 5, describes it. - Drawing settings stay out of it: the `render` block, a reference's `point`, a node's `id_position` and an arrow's `arrow_spacing`. - A journey with a syntax error gets no model (20.6). ## Fill unique ids A node that other files link to gets a unique id. You write the placeholder `unique_id: {{auto}}`, and `-populate_ids` fills it (7.1). Local build only: ```text java -jar plantuml.jar -populate_ids auth.puml ``` The line before: ```text unique_id: {{auto}} ' filled in by -populate_ids ``` The same line after: ```text unique_id: 6f2f4d29ca5 ' AUTO GENERATED - DO NOT CHANGE ``` What it changes in your file (7.3): - Each `{{auto}}` becomes a new random id of 11 lowercase hex digits, once. From then on the id never changes. - It writes in the file and on the line the placeholder came from, so a placeholder in an `!include`d file is filled in that file. - On that line, the trailing comment becomes `' AUTO GENERATED - DO NOT CHANGE`, replacing any comment that was there. The indentation and the column where the comment starts stay as they were. - Nothing else changes: other lines, line endings and encoding stay as they were. Display ids are never written. - After writing, the journey is drawn as usual. It is an error, and nothing is written, when: - there is no file to write: with `-pipe`, on the PlantUML server, or for any source that is not a file; - a loop or a macro produced the `{{auto}}`. Write that id in literally. Without the flag, the node is drawn as usual, the model marks its id as pending (`"uniqueId": null`, `"uniqueIdPending": true`), and a warning names the command with your file's path (7.2): ```text forgot_login: unique_id is still {{auto}}. Generate it before your first commit: java -jar plantuml.jar -populate_ids src/journeys/auth.puml ``` Fill every `{{auto}}` before the file's first commit. A git pre-commit hook that enforces this is described but not written yet (23.2). ## Errors and warnings - **A syntax error** stops the drawing. PlantUML shows its usual error image, naming the line, and no model is written (19.6). - **A warning** lets the journey draw. The warnings box under the drawing lists each one with its line and the handle it concerns, and the model holds the same list under `warnings` (20.6). - `warnings: hide` in the `render` block leaves the box out of the drawing; the warnings stay in the model. - One warning is in the box only: an arrow label with no free place (13.10). It depends on the layout, and the model does not. - Every error and warning is listed in section 21. ## Exit codes Exit codes are not documented yet. To check a journey from a script, read the `warnings` list in its model. A journey with a syntax error has no model. ## Not there yet - The `render` settings are not command-line flags. You set them in the `render` block (23.25). - Only the local build draws UJN. UJN is not part of PlantUML, so a standard PlantUML build, the public PlantUML server and editor plugins do not draw it.