Prompt (prompt v0.1.0)
Build interactive command line interfaces.
Link to this section Summary
Functions
Displays options to the user denoted by numbers.
Display text on the screen and wait for the users text imput.
Display a Y/n prompt.
Link to this section Functions
Link to this function
select(display, choices, opts \\ [])
Specs
Displays options to the user denoted by numbers.
Examples
iex> Prompt.select("You have many options", ["Choice A", "Choice B"])
You have many options:
[0] Choice A
[1] Choice B
Choose One [0-1]: 1
iex> "Choice A"
Link to this function
text_input(display, opts \\ [])
Specs
Display text on the screen and wait for the users text imput.
Examples
iex> Prompt.text_input("Enter your email")
Enter your email: t@t.com
iex> t@t.com
Link to this function
yes_or_no(question, opts \\ [])
Specs
Display a Y/n prompt.
Sets 'Y' as the the default answer, allowing the user to just press the enter key. To make 'n' the default answer pass the option default_answer: :no
Examples
iex> Prompt.yes_or_no("Send the email?")
Send the email? (Y/n): Y
iex> :yes
iex> Prompt.yes_or_no("Send the email?", default_answer: :no)
Send the email? (y/N): [enter]
iex> :no