A great Linux CLI tool for creating diagrams from a Domain Specific Language (DSL) is:
✅ Overview:
PlantUML allows you to create diagrams from a plain text description in a simple DSL. It supports a wide range of diagrams including:
- UML diagrams (class, sequence, activity, etc.)
- Entity-Relationship diagrams
- Gantt charts
- Mind maps
- Archimate diagrams
- JSON/YAML visualizations
- Wireframes (using Salt)
✅ Install on Linux:
You can install PlantUML via your package manager, or download the .jar and run it with Java.
Via package manager:
bash
sudo apt install plantuml # Debian/Ubuntu
sudo dnf install plantuml # Fedora
Using JAR (more up-to-date):
bash
wget https://github.com/plantuml/plantuml/releases/download/v1.2024.3/plantuml-1.2024.3.jar
Use it like:
bash
java -jar plantuml-1.2024.3.jar diagram.puml
✅ Example DSL (UML Class Diagram):
plantuml
@startuml
class Animal {
+name: String
+makeSound(): void
}
class Dog extends Animal {
+makeSound(): void
}
Animal <|-- Dog
@enduml
Save as diagram.puml and run:
bash
plantuml diagram.puml
It will generate a diagram.png in the same directory.
✅ Other CLI DSL → Diagram Tools:
| Tool | Description | CLI Support | DSL |
|---|
Mermaid CLI (@mermaid-js/mermaid-cli) | Render diagrams from text-based DSL in Mermaid syntax (used in many Markdown apps) | ✅ | Mermaid |
| Graphviz | Create graphs from DOT language | ✅ | DOT |
| D2 | Modern diagrams DSL like Markdown for diagrams, by terrastruct | ✅ | D2 |
| Structurizr CLI | Create C4 Software Architecture diagrams from DSL | ✅ | Structurizr DSL |
✅ If you're looking for something lightweight and modern:
⚡️ D2 – Declarative Diagramming Language
bash
curl -fsSL https://d2lang.com/install.sh | sh # install
Example:
d2
# example.d2
Alice -> Bob: Hello!
Render:
bash
d2 example.d2 out.svg
✅ Very readable DSL, supports different themes/layouts, and doesn't require Java.
🔚 Final Recommendation:
| Use Case | Tool |
|---|
| UML/class/sequence diagrams | PlantUML |
| Integration with Markdown | Mermaid |
| Graph-based diagrams (nodes/edges) | Graphviz |
| Modern, fast, all-purpose | D2 |
Let me know your use case and I can recommend the best one specifically.