Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yuzutech/kroki-cli

A Kroki CLI
https://github.com/yuzutech/kroki-cli

cli diagrams golang images kroki

Last synced: 6 days ago
JSON representation

A Kroki CLI

Awesome Lists containing this project

README

        

= 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 the package directly from source. The compiled binary will be put into `$GOPATH/bin/` or `$HOME/go/bin/` if `$GOPATH` is not set:

```bash
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
```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