# `mix ash_workflow.diagram`
[🔗](https://github.com/team-alembic/ash_workflow/blob/v0.12.0/lib/mix/tasks/ash_workflow.diagram.ex#L1)

Prints or writes a diagram of each AshWorkflow resource.

With resource names, draws those resources. With none, draws every resource
that uses `AshWorkflow` in the domains this project lists under
`:ash_domains`.

Without `--output`, prints each diagram. With several resources, the
diagrams follow one another, and `--format json` prints one JSON document
per line. With `--output DIR`, writes one file per resource, named after
it, such as `MyApp.Candidate.mmd`. The task draws every diagram first, so
an error prints or writes nothing.

In an umbrella project, run from the root, the task reads `:ash_domains`
from every child application.

## Options

* `--format` — a name from `AshWorkflow.Charts.formats/0`. Defaults to
  `mermaid`.
* `--output` — the directory to write the files to.
* `--svg` — with `--format dot`, print the chart as SVG, or write it to
  `.svg` files. Graphviz must be installed: see `AshWorkflow.Charts.Dot`.
* `--theme` — with `--format dot`, `light` or `dark`. Defaults to the
  `:theme` under `config :ash_workflow, :dot`, else `light`. A dark chart
  goes to a file such as `MyApp.Candidate-dark.svg`, so a light run and a
  dark run can write to the same directory.
* `--no-undo` — leave out undo edges.
* `--no-notes` — leave out step notes: policies, retry, timeouts that run
  an action, and `every` entries.

See `AshWorkflow.Charts` for what each format shows.

## Example

```bash
mix ash_workflow.diagram MyApp.Candidate
mix ash_workflow.diagram --format json --output priv/diagrams
mix ash_workflow.diagram --format dot --svg --theme dark MyApp.Candidate
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
