SpectreConsoleLibrary 1.0.0
.NET 6.0
dotnet add package SpectreConsoleLibrary --version 1.0.0
NuGet\Install-Package SpectreConsoleLibrary -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpectreConsoleLibrary" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpectreConsoleLibrary --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SpectreConsoleLibrary, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SpectreConsoleLibrary as a Cake Addin
#addin nuget:?package=SpectreConsoleLibrary&version=1.0.0
// Install SpectreConsoleLibrary as a Cake Tool
#tool nuget:?package=SpectreConsoleLibrary&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
About
Provides easy to use common prompts.
Included
Name | Description | Comments |
---|---|---|
GetFirstName | prompt for first name | Allows no input which returns an empty string |
GetMiddleName | prompt for first name | Allows no input which returns an empty string |
GetLastName | prompt for last name | Allows no input which returns an empty string |
GetInt | prompts for an int | |
GetPin | prompts for an int with length of four | |
GetSSN | prompts for an social security number | hidden with special validation |
GetDecimal | prompts for a decimal | |
GetDouble | prompts for a double | |
GetBirthDate | prompts for a birth date | |
GetDateTime | prompts for a regular DateTime | |
GetDateOnly | prompts for a nullable DateOnly | accepts a start value or has a default value |
GetTimeOnly | prompts for a nullable TimeOnly | accepts a start value or has a default value |
GetBool | prompts for Yes or No | returns a bool |
GetUserName | prompt for user name | suitable for a login |
GetPassword | prompt for a password masked | suitable for a login |
GetNewPassword | prompts for a new password | has default rules which can be changed see package repo |
AskConfirmation | Ask a question | returns a bool |
MonthsSelection | presents a list of months | allows single or mulitple selections |
GenericSelectionList<T> | Present a list where the user can select one or more items | |
using SpectreConsoleLibrary;
using TaxpayerConsoleApp.Models;
namespace TaxpayerConsoleApp;
internal partial class Program
{
static void Main(string[] args)
{
var taxpayer = GetTaxpayer();
Console.Clear();
AnsiConsole.MarkupLine("[cyan]Taxpayer details[/]");
AnsiConsole.MarkupLine($"\t[yellow]Name[/] {taxpayer.FirstName} {taxpayer.LastName}");
AnsiConsole.MarkupLine($"\t[yellow]SSN[/] {taxpayer.SSN}");
AnsiConsole.MarkupLine($"\t[yellow]Pin[/] {taxpayer.Pin}");
AnsiConsole.MarkupLine($"\t[yellow]Start date[/] {taxpayer.StartDate}");
Console.ReadLine();
}
internal static Taxpayer GetTaxpayer()
{
Taxpayer taxpayer = new()
{
FirstName = Prompts.GetFirstName(false),
LastName = Prompts.GetLastName(false),
StartDate = Prompts.GetDateOnly(new DateOnly(2022, 2, 2)),
SSN = Prompts.GetSSN(),
Pin = Prompts.GetPin().ToString()
};
return taxpayer;
}
}
Product | Versions |
---|---|
.NET | net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- EzPasswordValidator (>= 2.1.0)
- Spectre.Console (>= 0.44.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 179 | 9/13/2022 |
Initial release