# `mix finitomata.generate`
[🔗](https://github.com/am-kantox/finitomata/blob/v0.35.0/lib/mix/tasks/finitomata_generate.ex#L1)

Mix task to generate the `Finitomata` instance scaffold.

By running `mix finitomata.generate --module MyFSM` one would be prompted
to enter the _FSM_ declartion if `ELIXIR_EDITOR` environment variable is set,
in the same way as `IEx.Helpers.open/0` does. THen the scaffold implementation
(and optionally the test for it) will be generated.

### Allowed arguments

- **`--module: :string`** __[mandatory]__ the name of the module to generate, it will be prepended
  with `OtpApp.Finitomata.`
- **`--fsm-file: :string`** __[optional, default: `nil`]__ the name of the file to read the FSM description from,
  the `ELIXIR_EDITOR` will be opened to enter a description otherwise
- **`--syntax: :string`** __[optional, default: `:flowchart`]__ the syntax to be used, might be
  `:flowchart`, `:state_diagram`, or a module name for custom implementation
- **`--timer: :integer`** __[optional, default: `false`]__ whether to use recurrent calls in
  this _FSM_ implementation
- **`--auto-terminate: :boolean`** __[optional, default: `false`]__ whether the ending states should
  lead to auto-termination
- **`--listener: :string`** __[optional, default: `nil`]__ the listener implementation
- **`--impl-for: :string`** __[optional, default: `:all`]__ what callbacks should be auto-implemented 
- **`--generate-test: :boolean`** __[optional, default `false`]__ whether the test should be
  generated as well
- **`--callback: :string`** __[optional, default: `nil`]__ the function to be called before actual generation

### Example

```sh
mix finitomata.generate --module MyFSM --timer 1000 --auto-terminate true --generate-test true
```

---

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