{"id":18626656,"url":"https://github.com/silbermm/prompt","last_synced_at":"2025-04-11T05:31:12.388Z","repository":{"id":38326770,"uuid":"301017028","full_name":"silbermm/prompt","owner":"silbermm","description":"Build interactive CLI's in Elixir","archived":false,"fork":false,"pushed_at":"2025-01-20T21:59:37.000Z","size":2061,"stargazers_count":30,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T07:19:02.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://codeberg.org/ahappydeath/prompt","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silbermm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-04T01:25:56.000Z","updated_at":"2025-02-19T21:24:16.000Z","dependencies_parsed_at":"2023-12-12T04:23:52.827Z","dependency_job_id":"bb84d71b-e9ef-4b2b-989c-f47bba218c59","html_url":"https://github.com/silbermm/prompt","commit_stats":{"total_commits":155,"total_committers":2,"mean_commits":77.5,"dds":"0.40645161290322585","last_synced_commit":"35302cc8ec0561427585e02c2b6a8ea86eaa3c00"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silbermm%2Fprompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silbermm%2Fprompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silbermm%2Fprompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silbermm%2Fprompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silbermm","download_url":"https://codeload.github.com/silbermm/prompt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248347400,"owners_count":21088640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T04:38:35.745Z","updated_at":"2025-04-11T05:31:12.359Z","avatar_url":"https://github.com/silbermm.png","language":"Elixir","funding_links":[],"categories":["Command Line Applications"],"sub_categories":[],"readme":"# HEADS UP\nAll future development will happen at [https://codeberg.org/ahappydeath/prompt](https://codeberg.org/ahappydeath/prompt)\n\n![prompt_with_text_lighter](https://user-images.githubusercontent.com/42816/115971052-5772c380-a514-11eb-8b43-dd49e81467f5.png)\n\n![](https://github.com/silbermm/prompt/workflows/Build/badge.svg)\n[![Hex.pm](https://img.shields.io/hexpm/v/prompt?style=flat-square)](https://hexdocs.pm/prompt/Prompt.html#content)\n\n# Terminal UI Library for Elixir\n\n* [Motivation](#motivation)\n* [Installation](#installation)\n* [Basic Usage](#basic-usage)\n  * [Display text on the screen](#display-text-on-the-screen)\n  * [Ask the user for input](#ask-the-user-for-input)\n  * [Ask the user for a password](#ask-the-user-for-a-password)\n  * [Ask the user for confirmation](#ask-the-user-for-confirmation)\n  * [Custom confirmation choices](#custom-confirmation-choices)\n  * [List of selections](#list-of-selections)\n  * [Tables](#tables)\n* [Advanced Usage](#advanced-usage-with-subcommands)\n* [Example Application](#example)\n\n\n[![Run in Livebook](https://livebook.dev/badge/v1/black.svg)](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fsilbermm%2Fprompt%2Fblob%2Fmain%2Fexample.livemd)\n\n\n## Motivation\n\nTo create a really great development experience and API for Elixir developers that want to build commandline tools.\n\n## Installation\n\nAdd `prompt` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:prompt, \"~\u003e 0.8.0\"}\n  ]\nend\n```\n\n[Read the official documentation](https://hexdocs.pm/prompt/Prompt.html)\n\n## Basic Usage\nAll of the following commands take a keyword list of options for things like text color and positioning.\n\n### Display text on the screen\n[Prompt.display/2](https://hexdocs.pm/prompt/Prompt.html#display/2)\n```elixir\nPrompt.display(\"Hello, world!\")\n```\n\n### Ask the user for input\n[Prompt.text/2](https://hexdocs.pm/prompt/Prompt.html#text/2)\nUseful for prompting the user to enter freeform text\n```elixir\nPrompt.text(\"Enter info here\")\n```\nWill display:\n```bash\n\u003e Enter info here:\n```\nand wait for the user to enter text\n\n### Ask the user for a password\n[Prompt.password/2](https://hexdocs.pm/prompt/Prompt.html#password/2)\nWhen you need to hide the input that the user types\n```elixir\nPrompt.password(\"Enter password\")\n```\n\n### Ask the user for confirmation\n[Prompt.confirm/2](https://hexdocs.pm/prompt/Prompt.html#confirm/2)\n```elixir\nPrompt.confirm(\"Are you sure?\")\n```\nWill display:\n```bash\n\u003e Are you sure? (Y/n):\n```\nand will allow the user to just press [enter] to confirm\n\nIf you'd prefer `n` to be the default pass the `default_answer` option\n```elixir\nPrompt.confirm(\"Are you sure?\", default_answer: :no)\n```\nReturns `:yes` or `:no` based on the answer\n\n### Custom confirmation choices\n[Prompt.choice/2](https://hexdocs.pm/prompt/Prompt.html#choice/2)\nSometimes yes/no aren't the only choices a user can make, this method allows you to pass any choices as the confirmation.\n```elixir\nPrompt.choice(\"Accept, Reload or Cancel\", accept: \"a\", reload: \"r\", cancel: \"c\")\n```\ndisplays\n```bash\n\u003e Accept, Reload or Cancel (A/r/c):\n```\nReturns the key of the answer i.e `:accept`, `:reload` or `cancel` in this exammple\n\n### List of selections\n[Prompt.select/2](https://hexdocs.pm/prompt/Prompt.html#select/2)\nTo show the user a list of options to select from\n\n```elixir\nPrompt.select(\"Choose a protocol\", [\"file://\", \"ssh://\", \"ftp://\"])\n```\nDisplays:\n```bash\n  [1] file://\n  [2] ssh://\n  [3] ftp://\n\u003e Choose a protocol [1-3]:\n```\nand returns a string of their choice\n\n### Tables\n[Prompt.table/2](https://hexdocs.pm/prompt/Prompt.html#table/2)\nTo show a table of data\n```elixir\nPrompt.table([[\"Hello\", \"from\", \"the\", \"terminal!\"],[\"this\", \"is\", \"another\", \"row\"]])\n```\nWill display\n```bash\n\u003e +-------+------+---------+----------+\n  | Hello | from | the     | terminal |\n  | this  | is   | another | row      |\n  +-------+------+---------+----------+\n```\n\n## Advanced Usage with Subcommands\nTo use the more advanced features, see the [official documentation](https://hexdocs.pm/prompt/Prompt.html#module-subcommands)\n\n## Example\nFor a complete example, take a look at [Slim - a cherry-picking tool](https://github.com/silbermm/slim_pickens)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilbermm%2Fprompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilbermm%2Fprompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilbermm%2Fprompt/lists"}