The component behind Drafter.Prompt.text/2, password/2, number/2 and
readline/2: one line of text with editing keys, history and Tab completion.
Options
:label- the question, or the prompt string when:plainis set:default- the value used when the line is submitted empty:placeholder- dimmed text shown while the line is empty:validate-(value -> :ok | {:error, message}), run on submit:parse-(text -> {:ok, value} | {:error, message}), run on submit before:validate; the prompt returnsvalue:complete- aDrafter.Prompt.Completion.source/0for Tab:history- earlier lines, newest first, recalled with Up and Down:mask- a character shown in place of every typed one:plain-truedraws only the label and the line, and leaves both on screen unchanged when the prompt ends:limit- the most completion candidates listed at once. Defaultconfig :drafter, prompt_limit: 7
Keys
Enter submits. Esc stops the prompt with :cancelled, and Ctrl+D on an empty line
stops it with :eof. Up and Down recall history. Tab completes: one candidate is
inserted, and several are listed, after which Tab, Shift+Tab, Up and Down step
through them, Enter keeps the chosen one and Esc closes the list. Every other key is
an editing key of Drafter.Prompt.Editor.