Skip to content

Command line

Shin Sterneck edited this page Nov 8, 2026 · 1 revision
stratagram [FILE.stratagram]
stratagram --version
stratagram --export-svg IN.stratagram OUT.svg
stratagram --export-drawio IN.stratagram OUT.drawio     (all sheets, as pages)
stratagram --export-cml IN.stratagram OUT.yaml          (a Cisco Modeling Labs lab)
stratagram --export-png IN.stratagram OUT.png [SCALE]   (pixels per unit, default 2)
stratagram --layout KIND IN.stratagram OUT.stratagram [SPACING]

Passing a file name opens it in the editor; if it does not exist yet, Ctrl+S saves to that name.

Exports

All exports work without the window, for scripts and pipelines. SVG and PNG show the first sheet. Add --theme dark or --theme neon to export them in that theme (light by default).

stratagram --export-drawio site.stratagram site.drawio   # every sheet as a page
stratagram --export-svg site.stratagram site.svg
stratagram --export-cml site.stratagram site-lab.yaml
stratagram --export-png site.stratagram site.png 3
stratagram --export-png site.stratagram site-dark.png --theme dark

Layouts for generated diagrams

Files written by scripts can leave the placement to the app: devices need no x, y, w, h or color, ports no side or t, and device types may use short forms (fw, sw, srv, tgw...). --layout then runs an auto layout on every sheet and saves the result (OUT may be the same file):

stratagram --layout hierarchy generated.stratagram generated.stratagram [SPACING]

KIND is one of hierarchy, hierarchy-lr, radial, circle, grid, force or tidy; the spacing is 60 by default.

On Windows

stratagram.exe is a window application: the command line modes print to the console they are started from, but the prompt does not wait for them. In scripts, wait with start /wait stratagram ... (cmd) or Start-Process -Wait (PowerShell).

Clone this wiki locally