Commando.UI 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Commando.UI --version 1.3.0
NuGet\Install-Package Commando.UI -Version 1.3.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="Commando.UI" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Commando.UI --version 1.3.0
#r "nuget: Commando.UI, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Commando.UI as a Cake Addin
#addin nuget:?package=Commando.UI&version=1.3.0

// Install Commando.UI as a Cake Tool
#tool nuget:?package=Commando.UI&version=1.3.0

Commando

C# library for creating command line user interfaces.

Install

PM> Install-Package Commando.UI

Table of content

Features

Printing

Font style

Example
CommandoTextWriter.Use();
"Red text".Red();
"Blue bold text".Blue().Bold();
Available styles
Colors
  • White
  • Grey
  • Black
  • Blue
  • Cyan
  • Green
  • Magenta
  • Red
  • Yellow
  • Zebra
  • Rainbow
Font weight
  • Bold
  • Italic
  • Underline
  • Inverse
Other
  • Reset - resets format

Table print

var table = new TablePrinter("Country", "Capital", "Population");
table.AddRow("Sweden", "Stockholm", "~1,3M");
table.AddRow("Norway", "Oslo", "~900k");
table.AddRow("Finland", "Helsinki", "~600k");
table.AddRow("Denmark", "Copenhagen", "~1,3M");
table.Print();

Table

Pretty print

var pretty = new PrettyPrinter();
pretty.Add("Sweden", "Stockholm");
pretty.Add("Norway", "Oslo");
pretty.Add("Finland", "Helsinki");
pretty.Add("Denmark", "Copenhagen");
pretty.Print();

Pretty

Select lists

Single select list

var prompt = new SelectPrompt("Choose country");
prompt.Add(new PromptItem("Sweden", "SE"));
prompt.Add(new PromptItem("Norway", "NO"));
prompt.Add(new PromptItem("Finland", "FI"));
prompt.Add(new PromptItem("Denmark", "DK"));
var item = prompt.Prompt();

Select prompt

Multi select/checkbox list

var multiprompt = new MultiSelectPrompt("Choose countries");
multiprompt.Add(new PromptItem("Sweden", "SE"));
multiprompt.Add(new PromptItem("Norway", "NO"));
multiprompt.Add(new PromptItem("Finland", "FI"));
multiprompt.Add(new PromptItem("Denmark", "DK"));
var answer = multiprompt.Prompt();

Multi select

Prompts

Question prompts

Available prompt types is Password and Text.

var username = new Question("Username", QuestionType.Text).Prompt();
var password = new Question("Password", QuestionType.Password).Prompt();

Question prompt

Yes/No prompt

Console.WriteLine($"You choosed Sweden: SE");
var answer = new YesNoQuestion("Is this correct?").Prompt();

Yes/No prompt

Progress bar

ProgressBar progressBar = new ProgressBar();
progressBar.Set(10, "Initializing");
progressBar.Set(20, "Downloading...");
progressBar.Set(30);
progressBar.Set(40);
progressBar.Set(50, "Building");
progressBar.Set(60);
progressBar.Set(70);
progressBar.Set(80);
progressBar.Set(90, "Finishing");
progressBar.Set(100);

Progressbar

License

MIT License

Copyright (c) 2016 Victor Alveflo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
2.0.0 696 10/11/2019
1.3.0 2,966 11/30/2017
1.2.0 1,509 9/28/2016
1.1.0 1,337 9/21/2016
1.0.0 1,433 9/21/2016