{"id":18745434,"url":"https://github.com/yassinebenaid/prompts","last_synced_at":"2025-11-23T10:30:16.908Z","repository":{"id":197287348,"uuid":"668019531","full_name":"yassinebenaid/prompts","owner":"yassinebenaid","description":"Build intuitive CLI prompts with ease","archived":false,"fork":false,"pushed_at":"2023-12-18T09:51:51.000Z","size":86,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T20:24:12.078Z","etag":null,"topics":["cli","go","golang","library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yassinebenaid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-07-18T20:40:30.000Z","updated_at":"2024-03-06T21:04:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"daf6b0c4-6a09-4854-99a3-dc6051608ed6","html_url":"https://github.com/yassinebenaid/prompts","commit_stats":null,"previous_names":["yassinebenaid/prompts"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassinebenaid%2Fprompts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassinebenaid%2Fprompts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassinebenaid%2Fprompts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassinebenaid%2Fprompts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yassinebenaid","download_url":"https://codeload.github.com/yassinebenaid/prompts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239627235,"owners_count":19670844,"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":["cli","go","golang","library"],"created_at":"2024-11-07T16:18:05.171Z","updated_at":"2025-11-23T10:30:16.826Z","avatar_url":"https://github.com/yassinebenaid.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prompts\n\nBuild command line prompts with ease, prompts provides several TUI components to create intuitive CLI applications faster,\n\n![Screenshot from 2023-09-30 19-38-45](https://github.com/yassinebenaid/prompts/assets/101285507/7ef5edb3-b13c-4e64-b03d-74f627165982)\n\n## Installation\n\n```bash\ngo get github.com/yassinebenaid/prompts\n```\n\n## API\n\n### Input\n\nThe input api allows you to prompt the user for an input , it returns the input value\n\n- **Usage**:\n\n```go\n// [...]\n\nvalue, err := prompts.InputBox(prompts.InputOptions{\n\tSecure:      false, // hides the user input, very common for passwords\n\tLabel:       \"what is your name?\",\n\tPlaceholder: \"what is your name\",\n\tRequired:    true,\n\tValidator:   func(value string) error {// will be called when user submit, and returned error will be displayed to the user below the input\n\t\tif len(value) \u003c 3{\n\t\t\treturn fmt.Errorf(\"minimum len is 3\")\n\t\t}\n\t\treturn nil\n\t},\n})\n\nif err != nil{\n\tlog.Fatal(err)\n}\n\nfmt.Println(\"selected \" + value)\n```\n\n- **Result**:\n\n![image](https://github.com/yassinebenaid/prompts/assets/101285507/de482c92-7ab3-4a36-a68a-422f3f74de02)\n![image](https://github.com/yassinebenaid/prompts/assets/101285507/025942de-025d-4e5d-a476-172c3311cf5e)\n\n#\n\n### Password Input\n\nThe password input api is just normal input but with `Secure` option set to `true` ,\n\n- **Usage**:\n\n```go\n// [...]\n\nvalue, err := prompts.InputBox(prompts.InputOptions{\n\tSecure:      true, // set password mode\n\tLabel:       \"what is your password?\",\n\tPlaceholder: \"what is your password\",\n\tRequired:    true,\n\tValidator:   func(value string) error {// will be called when user submit, and returned error will be displayed to the user below the input\n\t\tif len(value) \u003c 3{\n\t\t\treturn fmt.Errorf(\"minimum len is 3\")\n\t\t}\n\t\treturn nil\n\t},\n})\n\nif err != nil{\n\tlog.Fatal(err)\n}\n\nfmt.Println(\"password : \" + value)\n```\n\n- **Result**:\n\n![image](https://github.com/yassinebenaid/prompts/assets/101285507/825f5688-9d55-4e2d-acf2-c5b308dfc4a5)\n\n#\n\n### Confirmation Input\n\nThe confirmation api can be used to prompt the user for confirmation , it returns a boolean ,\n\n- **Usage**:\n\n```go\n// [...]\n\nconst DEFAULT = true\nvalue, err := prompts.ConfirmBox(\"are you sure ?\", DEFAULT)\n\nif err != nil {\n\tlog.Fatal(err)\n}\n\nfmt.Println(\"answer : \", value)\n```\n\n- **Result**:\n\n  ![image](https://github.com/yassinebenaid/prompts/assets/101285507/8a6c51cb-847d-415a-b11e-96cbf0a2beeb)\n\n#\n\n### Radio Input\n\nThe radio api can be used to prompt the user to choose one of several options , it returns a the index of the checked option ,\n\n- **Usage**:\n\n```go\n// [...]\n\ngenders := []string{\"male\", \"female\"}\nvalue, err := prompts.RadioBox(\"Choose your gender : \", genders)\n\nif err != nil {\n\tlog.Fatal(err)\n}\n\nfmt.Println(\"gender : \", genders[value])\n```\n\n- **Result**:\n\n  ![image](https://github.com/yassinebenaid/prompts/assets/101285507/52e82922-844c-4c3a-89b7-a9d8800cd5b0)\n\n#\n\n### Select Box\n\nThe select box api can be used to prompt the user to choose between several options , it returns a slice of selected indexes,\n\n- **Usage**:\n\n```go\n// [...]\n\nhobbies := []string{\"swimming\", \"coding\", \"gaming\", \"playing\"}\nvalue, err := prompts.SelectBox(\"Choose your hobbies : \", hobbies)\n\nif err != nil {\n\tlog.Fatal(err)\n}\n\nfmt.Println(\"gender : \", value)\n```\n\n- **Result**:\n\n  ![image](https://github.com/yassinebenaid/prompts/assets/101285507/192424db-c9fe-480d-9f9b-4f8d6cdff56b)\n\n#\n\n### Alerts\n\nthese are helper apis you can use for better alerts and messages.\n\n```go\nprompts.Info(\"Info alert\")\nprompts.Error(\"Error alert\")\nprompts.Warning(\"Warning alert\")\nprompts.Success(\"Success alert\")\n```\n\n- **Result**:\n\n![Screenshot from 2023-09-29 18-18-21](https://github.com/yassinebenaid/prompts/assets/101285507/d380f45b-4db4-4a9d-b4a2-8edf5f518579)\n\n```go\nprompts.InfoMessage(\"Info message\")\nprompts.ErrorMessage(\"Error message\")\nprompts.WarningMessage(\"Warning message\")\nprompts.SuccessMessage(\"Success message\")\n```\n\n![Screenshot from 2023-09-29 18-19-17](https://github.com/yassinebenaid/prompts/assets/101285507/90fc7d67-f0fe-4608-9f57-b5a0852129f7)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyassinebenaid%2Fprompts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyassinebenaid%2Fprompts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyassinebenaid%2Fprompts/lists"}