# `Drafter.Prompt.Script`
[🔗](https://github.com/jaman/drafter/blob/v0.6.0/lib/drafter/prompt/script.ex#L1)

Runs code that asks questions against a list of keys, with no terminal.

    {answers, transcript} =
      Drafter.Prompt.Script.run(["ada", :enter, :down, :enter], fn ->
        {:ok, name} = Drafter.Prompt.text("Name")
        {:ok, kind} = Drafter.Prompt.select("Kind", ["App", "Library"])
        {name, kind}
      end)

    answers
    #=> {"ada", "Library"}

    transcript
    #=> "✔ Name · ada\n✔ Kind · Library\n"

## Inputs

Each input is one of:

  * a string, typed one character at a time; `"\r"` is Enter and `"\t"` is Tab
  * an atom naming a key, such as `:enter`, `:down`, `:tab`, `:escape` or
    `:backspace`; `:space` is the space bar
  * an event as `Drafter.Terminal.ANSI` decodes it, such as `{:key, :c, [:ctrl]}`

A prompt that is still waiting when the inputs run out returns `{:error, :eof}`.

The transcript holds the line each prompt left on screen, what
`Drafter.Prompt.say/2` wrote, and what was written during a spinner or progress
bar, in order and without styling.

## Options

  * `:size` - `{columns, rows}` reported to prompts. Default `{80, 24}`.

# `input`

```elixir
@type input() :: String.t() | atom() | Drafter.Prompt.Terminal.event()
```

# `run`

```elixir
@spec run([input()], (-&gt; result), keyword()) :: {result, String.t()} when result: var
```

Call `fun` with `inputs` standing in for the keyboard.

Returns what `fun` returned and the transcript. Only prompts asked by the calling
process read the inputs.

---

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