Popularity
3.5
Declining
Activity
0.0
Stable
29
2
2

Monthly Downloads: 1,390
Programming language: Elixir
License: MIT License

ex_prompt alternatives and similar packages

Based on the "Command Line Applications" category.
Alternatively, view ex_prompt alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of ex_prompt or a related project?

Add another 'Command Line Applications' Package

README

ExPrompt Build Status Hex pm Hex.pm

ExPrompt is a helper package to add interactivity to your command line applications as easy as possible.

It allows common operations such as: asking for an answer (required or not), choosing between several options, asking for confirmation and asking for a password.

Preview

ExPrompt

Installation

The package can be installed by adding ex_prompt to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_prompt, "~> 0.1.5"}
  ]
end

Documentation

See the full documentation and API at hexdocs/ex_prompt.

string(prompt)

Prompts the user for some input.

iex> ExPrompt.string("What is your name?")
iex> What is your name? |

string_required(prompt)

Same as string but if we get no response, it will keep asking until we do.

iex> ExPrompt.string_required("What is your name?")
iex> What is your name? |

choose(prompt, choices)

Asks the user to choose between several options from a list. It returns either the index of the element in the list or -1 if it's not found.

This method tries first to get said element by the list number, if it fails it will attempt to get the index from the list of choices by the value that the user wrote.

iex> ExPrompt.choose("What is your favorite color?", ~w(Red Green Blue))
iex>
      1) Red
      2) Green
      3) Blue

  What is your favorite color? |

confirm(prompt)

Asks for confirmation to the user. It allows the user to answer or respond with the following options:

  • Yes, yes, YES, Y, y
  • No, no, NO, N, n

In case that the answer is none of the above, it will prompt again until we do.

iex> ExPrompt.confirm("Are you sure?")
iex> Are you sure? [Yn] |

yes?(prompt)

Alias for confirm(prompt).

password(prompt, hide \\ true)

Asks for a password.

This method will hide the password by default as the user types. If that's not the desired behavior, it accepts false, and the password will be shown as it's being typed.

iex> ExPrompt.password("Your password:")
iex> Your password: |

License

Check LICENSE.


*Note that all licence references and agreements mentioned in the ex_prompt README section above are relevant to that project's source code only.