| 1 | <h1 align="center">Promptuity</h1> |
| 2 | <p align="center"><small>Promptuity = Prompt + Ingenuity</small></p> |
| 3 | <p align="center"> |
| 4 | <a href="https://github.com/wadackel/promptuity/actions/workflows/ci.yml?query=branch%3Amain"><img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/wadackel/promptuity/ci.yml?branch=main&style=flat-square&logo=GitHub%20Actions&logoColor=white"></a> |
| 5 | <a href="https://crates.io/crates/promptuity/"><img alt="Crates.io Version" src="https://img.shields.io/crates/v/promptuity?style=flat-square&logo=Rust&logoColor=white"></a> |
| 6 | <a href="https://docs.rs/promptuity"><img alt="docs.rs" src="https://img.shields.io/docsrs/promptuity?style=flat-square&logo=Rust&logoColor=white"></a> |
| 7 | <a href="https://github.com/wadackel/promptuity/blob/main/LICENSE"><img src="https://img.shields.io/github/license/wadackel/promptuity?label=license&style=flat-square" alt="MIT LICENSE" /></a> |
| 8 | </p> |
| 9 | <p align="center">Promptuity is a library that provides interactive prompts. It is highly extensible, allowing you to build your original prompts from scratch. It brings <strong>ingenuity</strong> to various projects.</p> |
| 10 | |
| 11 | ## Table Of Contents |
| 12 | |
| 13 | - [Concept](#concept) |
| 14 | - [Quick Start](#quick-start) |
| 15 | - [Examples](#examples) |
| 16 | - [Documentation](#documentation) |
| 17 | - [Prompts](#prompts) |
| 18 | - [Input](#input) |
| 19 | - [Password](#password) |
| 20 | - [Number](#number) |
| 21 | - [Select](#select) |
| 22 | - [MultiSelect](#multiselect) |
| 23 | - [Confirm](#confirm) |
| 24 | - [Autocomplete](#autocomplete) |
| 25 | - [Themes](#themes) |
| 26 | - [MinimalTheme](#minimaltheme) |
| 27 | - [FancyTheme](#fancytheme) |
| 28 | - [Customize](#customize) |
| 29 | - [Build your own Prompt](#build-your-own-prompt) |
| 30 | - [Build your own Theme](#build-your-own-theme) |
| 31 | - [Error Handling](#error-handling) |
| 32 | - [Testing](#testing) |
| 33 | - [Alternatives](#alternatives) |
| 34 | - [Inspired](#inspired) |
| 35 | - [Contributing](#contributing) |
| 36 | - [CHANGELOG](#changelog) |
| 37 | - [License](#license) |
| 38 | |
| 39 | ## Concept |
| 40 | |
| 41 | - :zap: **Not easy, But simple** |
| 42 | - Avoids APIs with implicit behavior, aiming to provide as transparent APIs as possible. |
| 43 | - The amount of code required to start a prompt may be more compared to other libraries. |
| 44 | - :hammer: **Extensible** |
| 45 | - You can customize built-in prompts or build your prompts from scratch. |
| 46 | - The built-in prompts are minimal, assuming that prompt requirements vary by project. |
| 47 | - :nail_care: **Beautiful** |
| 48 | - Offers two types of built-in Themes. |
| 49 | - Themes can also be fully customized to fit your ideal. |
| 50 | |
| 51 | ## Quick Start |
| 52 | |
| 53 |  |
| 54 | |
| 55 | The basic usage is as follows. |
| 56 | |
| 57 | ```rust |
| 58 | use promptuity::prompts::{Confirm, Input, Select, SelectOption}; |
| 59 | use promptuity::themes::FancyTheme; |
| 60 | use promptuity::{Error, Promptuity, Term}; |
| 61 | |
| 62 | fn main() -> Result<(), Error> { |
| 63 | let mut term = Term::default(); |
| 64 | let mut theme = FancyTheme::default(); |
| 65 | let mut p = Promptuity::new(&mut term, &mut theme); |
| 66 | |
| 67 | p.term().clear()?; |
| 68 | |
| 69 | p.with_intro("Survey").begin()?; |
| 70 | |
| 71 | let name = p.prompt(Input::new("Please enter your username").with_placeholder("username"))?; |
| 72 | |
| 73 | let _ = p.prompt(Confirm::new("Are you a full-time software developer?").with_default(true))?; |
| 74 | |
| 75 | let _ = p.prompt( |
| 76 | Select::new( |
| 77 | "Select your primary programming language", |
| 78 | vec![ |
| 79 | SelectOption::new("Rust", "rust"), |
| 80 | SelectOption::new("Go", "go"), |
| 81 | SelectOption::new("C++", "cpp"), |
| 82 | SelectOption::new("C", "c"), |
| 83 | SelectOption::new("TypeScript", "typescript"), |
| 84 | SelectOption::new("JavaScript", "javascript"), |
| 85 | SelectOption::new("Deno", "deno"), |
| 86 | SelectOption::new("Python", "python"), |
| 87 | SelectOption::new("Java", "java"), |
| 88 | SelectOption::new("Dart", "dart"), |
| 89 | SelectOption::new("Other", "other"), |
| 90 | ], |
| 91 | ) |
| 92 | .with_hint("Submit with Space or Enter."), |
| 93 | )?; |
| 94 | |
| 95 | p.with_outro(format!("Thank you |