{"id":15036124,"url":"https://github.com/rephidock/rephidock.consoleprompts","last_synced_at":"2026-04-02T02:46:43.748Z","repository":{"id":200134600,"uuid":"700526517","full_name":"Rephidock/Rephidock.ConsolePrompts","owner":"Rephidock","description":"A library to take user input in a console with exception handling and fluent syntax.","archived":false,"fork":false,"pushed_at":"2023-11-01T14:26:11.000Z","size":99,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-27T06:06:53.600Z","etag":null,"topics":["console","console-io","csharp","csharp-library"],"latest_commit_sha":null,"homepage":"","language":"C#","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/Rephidock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-04T18:54:52.000Z","updated_at":"2023-12-19T16:47:25.000Z","dependencies_parsed_at":"2023-10-25T16:44:17.382Z","dependency_job_id":"1bcebf55-cc0b-49b0-abc1-c28ca1b682b7","html_url":"https://github.com/Rephidock/Rephidock.ConsolePrompts","commit_stats":null,"previous_names":["rephidock/rephidock.consoleprompts"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rephidock%2FRephidock.ConsolePrompts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rephidock%2FRephidock.ConsolePrompts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rephidock%2FRephidock.ConsolePrompts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rephidock%2FRephidock.ConsolePrompts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rephidock","download_url":"https://codeload.github.com/Rephidock/Rephidock.ConsolePrompts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243401509,"owners_count":20285058,"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":["console","console-io","csharp","csharp-library"],"created_at":"2024-09-24T20:30:14.197Z","updated_at":"2025-12-28T15:16:17.444Z","avatar_url":"https://github.com/Rephidock.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Console Prompts\n\n[![GitHub License Badge](https://img.shields.io/github/license/Rephidock/Rephidock.ConsolePrompts)](https://github.com/Rephidock/Rephidock.ConsolePrompts/blob/main/LICENSE)\n[![Nuget Version Badge](https://img.shields.io/nuget/v/Rephidock.ConsolePrompts?logo=nuget)](https://www.nuget.org/packages/Rephidock.ConsolePrompts)\n\nA .NET library to take user input in a console with exception handling and fluent syntax.\n\n## Features\n\n- User input queries with fluent syntax\n- Support for strings, `IParsable`, including numbers, and booleans\n- Input restrictions (e.g. numeric range, string length, path to an existing file)\n- Invalid input handling\n- Hints and styling\n\n## Usage\n\nUse the `Prompt` class to create a query with one of the `For` methods, add restrictions to the query with fluent syntax and `Display` the query to the user.\n\n```csharp\nint userAge = Prompt.For\u003cint\u003e(\"Your age\").NoLessThan(1).Display();\nconst int drinkingAge = 21;\n\nif (userAge \u003e= drinkingAge)\n{\n\tConsole.WriteLine(\"You are of drinking age!\");\n}\nelse\n{\n\tConsole.WriteLine(\"Sorry, you can't have a drink.\");\n}\n```\n\n![image: example_prompt_age](media/example_prompt_age.png)\n\n### Advanced Use\n\nUse the `Prompter` class to customize how prompts and hints are displayed. \n\n```csharp\nPrompter prompter = new Prompter(autoSetupHints: false);\n\n// Set up all hints to be displayed\nprompter.SetHintHandlers(PromptHintHandlers.GetAllHandlers());\n\n// Change format of prompts\nprompter.PromptFormat = \"[{1}] {0} := \";\nprompter.HintSeparator = \" \u0026 \";\nprompter.InvalidInputFormat = \"Not accepted: {0}\";\n\n// Example prompt\nfloat x = prompter\n\t.PromptFor\u003cfloat\u003e(\"x\")\n\t.AddTypeHint()\n\t.ForceFinite()\n\t.OfRange(-1, 1)\n\t.NotEqualTo(0)\n\t.Display();\n\nConsole.WriteLine($\"f(x) = 60 + 10 * {x} = {60 + 10 * x}\");\n```\n\n![image: example_styled_float](media/example_styled_float.png)\n\nSee [Demo Project](./src/Rephidock.ConsolePrompts.Demo) for a more full tutorial.\n\n## Installation\n\n### NuGet\n\nThe best way to add the library to your project is via NuGet package manager. Use the .NET CLI command:\n\n```\ndotnet add package Rephidock.ConsolePrompts\n```\n\nor the package browser in the IDE of your choice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frephidock%2Frephidock.consoleprompts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frephidock%2Frephidock.consoleprompts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frephidock%2Frephidock.consoleprompts/lists"}