Command-line tool
larrygram-cli reads Visio drawings and prints a summary, renders a page, or exports every page as PNG or SVG. It runs through the same command registry as the app (file.inspect, file.render, file.export), so a script sees the same behavior as a person.
Only inspect output and --help go to standard output. Errors and warnings go to standard error, one line each.
larrygram-cli - inspect, render and export Visio drawings
Usage: larrygram-cli inspect <file> [--json] [--page N] larrygram-cli render <file> --out <path> [--page N] [--format png|svg] [--scale PPI] [--background #RRGGBB|none] [--strict] larrygram-cli export <file> --out <dir> [--format png|svg] [--scale PPI] [--strict] larrygram-cli --helpBuild it from the repository with:
cargo build --release -p larrygram-cli./target/release/larrygram-cli --helpinspect
Section titled “inspect”Summarises a document: its kind, pages, masters, styles and themes.
| Flag | Meaning | Default |
|---|---|---|
--json |
Print the summary as one JSON object | text |
--page N |
Summarise one page, counted from 1 | every page |
larrygram-cli inspect flowchart.vsdxkind: drawingpages: 2 1: Page-1 8.5 x 11 in, 3 shapes, 0 warnings 2: (unnamed) 11 x 8.5 in, 0 shapes, 2 warningsmasters: 1styles: 4themes: 1warnings: 2With --json, the keys are stable:
{ "kind": "drawing", "masters": 1, "pages": [ { "height": 11.0, "index": 1, "name": "Page-1", "shapes": 3, "warnings": 0, "width": 8.5 }, { "height": 8.5, "index": 2, "name": "", "shapes": 0, "warnings": 2, "width": 11.0 } ], "styles": 4, "themes": 1, "warnings": 2}kind is drawing, stencil or template. Page sizes are in inches. A size that cannot be computed is 0.
render
Section titled “render”Renders one page to a PNG or SVG file.
| Flag | Meaning | Default |
|---|---|---|
--out PATH |
The output file (required) | — |
--page N |
The page to render, counted from 1 | the first page |
--format png|svg |
The output format | from the --out extension |
--scale PPI |
Device scale in pixels per inch; a positive number | 96 |
--background C |
#RRGGBB for an opaque color, or none for transparent |
the page’s own background |
--strict |
Exit with code 4 when warnings occurred (the file is still written) | off |
larrygram-cli render flowchart.vsdx --out page-1.png --scale 192larrygram-cli render flowchart.vsdx --out page-2.svg --page 2 --background noneexport
Section titled “export”Renders every page of a document into a directory. Files are named page-1.png, page-2.png and so on.
| Flag | Meaning | Default |
|---|---|---|
--out DIR |
The output directory (required) | — |
--format png|svg |
The output format | png |
--scale PPI |
Device scale in pixels per inch | 96 |
--strict |
Exit with code 4 when warnings occurred | off |
larrygram-cli export flowchart.vsdx --out pages/ --format svgExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
Success |
1 |
Usage error (bad arguments) |
2 |
Input error: the file is missing, unreadable or cannot be parsed |
3 |
Render or output error |
4 |
Warnings occurred and --strict is set |
Fail a job when a drawing renders with warnings:
for f in diagrams/*.vsdx; do larrygram-cli export "$f" --out "build/${f%.vsdx}" --format svg --strict || exit 1done