wischi-chr / Sharprompt

Interactive command line interface toolkit for .NET Core

Repository from Github https://github.comwischi-chr/SharpromptRepository from Github https://github.comwischi-chr/Sharprompt

Sharprompt

Build Status License

Interactive command line interface toolkit for .NET Core

sharprompt

NuGet Package

Package Name Target Framework NuGet
Sharprompt .NET Standard 2.0 NuGet

Install

Install-Package Sharprompt
dotnet add package Sharprompt

Usage

var name = Prompt.Input<string>("What's your name?");
Console.WriteLine($"Hello, {name}!");

var secret = Prompt.Password("Type new password", new[] { Validators.Required(), Validators.MinLength(8) });
Console.WriteLine("Password OK");

var answer = Prompt.Confirm("Are you ready?", defaultValue: true);
Console.WriteLine($"Your answer is {answer}");

APIs

Input

var name = Prompt.Input<string>("What's your name?");
Console.WriteLine($"Hello, {name}!");

input

Confirm

var answer = Prompt.Confirm("Are you ready?");
Console.WriteLine($"Your answer is {answer}");

confirm

Password

var secret = Prompt.Password("Type new password");
Console.WriteLine("Password OK");

password

Select

var city = Prompt.Select("Select your city", new[] { "Seattle", "London", "Tokyo" });
Console.WriteLine($"Hello, {city}!");

select

MultiSelect

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)}");

Platforms

  • Windows
    • Cmd / PowerShell / Windows Terminal (Preview)
  • Ubuntu
    • Bash
  • macOS
    • Bash

License

This project is licensed under the MIT License

About

Interactive command line interface toolkit for .NET Core

License:MIT License


Languages

Language:C# 100.0%