Skip to content

yuzutech/kroki-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d923cdd · Feb 5, 2023

History

31 Commits
Jul 2, 2022
Oct 12, 2022
Dec 8, 2022
Feb 17, 2019
Feb 21, 2019
Oct 12, 2022
Feb 5, 2023
Feb 21, 2019
Oct 12, 2022
Dec 8, 2022
Dec 8, 2022
Jul 2, 2022

Repository files navigation

Kroki CLI

Build Status

A CLI for https://kroki.io.

Usage

kroki convert hello.dot

By default, the diagram type will be inferred from the diagram file extension and the default output format will be SVG.

Long format:

kroki convert hello.dot --type dot --format svg

The output format can also be inferred from the output file using the --out-file flag:

kroki convert simple.er --out-file out.png

Read from stdin:

cat hello.dot | kroki convert - -t dot

By default, when reading from stdin using -, the result will be output to stdout. If you want to output to a file you can use -o:

cat hello.dot | kroki convert - -t dot -o out.png

Similarly, you can also output to stdout when reading from a file using the special value - with the --out-file flag:

kroki convert simple.er --out-file -

Installation

The releases page provides binaries for each version to download.

You can also install the package directly from source. The compiled binary will be put into $GOPATH/bin/ or $HOME/go/bin/ if $GOPATH is not set:

go install github.com/yuzutech/kroki-cli/cmd/kroki@latest

Configuration

To configure the endpoint, you can use a configuration file. The CLI will look for the following locations:

  • /etc/kroki.yml

  • $HOME/kroki.yml

  • kroki.yml

You can also specify an alternate config file using the --config flag:

kroki convert hello.dot --config config.yml

The config file should contain the endpoint URL and the HTTP timeout. By default, Kroki will use the demonstration server: https://demo.kroki.io and a timeout of 20 seconds.

Caution
Please note that the demonstration server usage is restricted to reasonable, non-commercial use-cases. We provide no guarantee regarding uptime or latency.

Example:

kroki.yml
endpoint: 'https://localhost:8000'
timeout: 30s

If you don’t want to use a file you can also use the following environment variables:

  • KROKI_ENDPOINT

  • KROKI_TIMEOUT

KROKI_ENDPOINT=https://localhost:8000 KROKI_TIMEOUT=1m kroki convert hello.dot