https://github.com/kieler/elk-cli
A commandline wrapper for elkjs.
https://github.com/kieler/elk-cli
Last synced: 8 months ago
JSON representation
A commandline wrapper for elkjs.
- Host: GitHub
- URL: https://github.com/kieler/elk-cli
- Owner: kieler
- License: epl-2.0
- Created: 2024-01-19T07:23:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-02T09:36:29.000Z (almost 2 years ago)
- Last Synced: 2025-05-07T13:58:29.405Z (8 months ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ELK-CLI
This is a simple wrapper around [elkjs](https://github.com/kieler/elkjs) to enable its usage directly from the commandline. It can be supplied with a graph from a file or directly over standard input. The expected format is the `elkj` format. When passing it directly in the commandline, care must be taken to correctly escape all quotes in the JSON object. The layouted graph is written `elkj` format to standard output.
## Installation
The elk cli tool can be installed using node:
```
> npm install -g @kieler/elk-cli
```
and then run as
```
> elk -f
```
You can also run it directly using npx
```
> npx @kieler/elk-cli -f
```
## Usage
Layout a graph provided in a json file:
```
> elk -f examples/graph.json
```
Layout a graph directly as an argument:
```
> elk -g "{\"id\": \"root\"}"
```
When passing in the graph as a string directly make sure to escape all double quotes that are part of the JSON.
## Generate SVGs
You can automatically generate a simple SVG of the laid out graph using the `-s ` option. A css file for styling may be supplied using the `-c ` file. The examples folder contains an example style file.