Interactive command-line based application framework for C#
$ dotnet add package SharpromptInteractive command line interface toolkit for C#

| Package Name | Target Framework | NuGet |
|---|---|---|
| Sharprompt | .NET Standard 2.0 |
Install-Package Sharprompt
dotnet add package Sharprompt
// Simple Input prompt
var name = Prompt.Input<string>("What's your name?");
Console.WriteLine($"Hello, {name}!");
// Password prompt
var secret = Prompt.Password("Type new password", new[] { Validators.Required(), Validators.MinLength(8) });
Console.WriteLine("Password OK");
// Confirmation prompt
var answer = Prompt.Confirm("Are you ready?", defaultValue: true);
Console.WriteLine($"Your answer is {answer}");
var name = Prompt.Input<string>("What's your name?");
Console.WriteLine($"Hello, {name}!");
var answer = Prompt.Confirm("Are you ready?");
Console.WriteLine($"Your answer is {answer}");
var secret = Prompt.Password("Type new password");
Console.WriteLine("Password OK");
var city = Prompt.Select("Select your city", new[] { "Seattle", "London", "Tokyo" });
Console.WriteLine($"Hello, {city}!");
Enum value support
var value = Prompt.Select<MyEnum>("Select enum value");
Console.WriteLine($"You selected {value}");var cities = Prompt.MultiSelect("Which cities would you like to visit?", new[] { "Seattle", "London", "Tokyo", "New York", "Singapore", "Shanghai" }, pageSize: 3);
Console.WriteLine($"You picked {string.Join(", ", options)}");
var value = Prompt.List<string>("Please add item(s)");
Console.WriteLine($"You picked {string.Join(", ", value)}");
Prompt.ColorSchema.Answer = ConsoleColor.DarkRed;
Prompt.ColorSchema.Select = ConsoleColor.DarkCyan;
var name = Prompt.Input<string>("What's your name?");
Console.WriteLine($"Hello, {name}!");
// Prefer UTF-8 as the output encoding
Console.OutputEncoding = Encoding.UTF8;
var name = Prompt.Input<string>("What's your name?");
Console.WriteLine($"Hello, {name}!");This project is licensed under the MIT License