A Kroki CLI
= Kroki CLI
image:https://github.com/yuzutech/kroki-cli/workflows/CI/badge.svg[Build Status,link=https://github.com/yuzutech/kroki-cli/actions?query=workflow%3ACI]
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 https://github.com/yuzutech/kroki-cli/releases[releases page] provides binaries for each version to download.
You can also install using https://pixi.prefix.dev/latest/installation/[Pixi]:
[source,bash]
pixi global install --channel https://prefix.dev/github-releases kroki-cli
Alternatively, you can 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.ymlkroki.yml
--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_ENDPOINTKROKI_TIMEOUT
KROKIENDPOINT=https://localhost:8000 KROKITIMEOUT=1m kroki convert hello.dot