ConsoleToolkit 1.2.0
See the version list below for details.
dotnet add package ConsoleToolkit --version 1.2.0
NuGet\Install-Package ConsoleToolkit -Version 1.2.0
<PackageReference Include="ConsoleToolkit" Version="1.2.0" />
paket add ConsoleToolkit --version 1.2.0
#r "nuget: ConsoleToolkit, 1.2.0"
// Install ConsoleToolkit as a Cake Addin #addin nuget:?package=ConsoleToolkit&version=1.2.0 // Install ConsoleToolkit as a Cake Tool #tool nuget:?package=ConsoleToolkit&version=1.2.0
A library providing a framework that allows you focus on the functionality you want to build rather than wasting your effort on the necessary but time consuming elements such as interpreting command line parameters, formatting help text, validating interactive input, and displaying data in a readable way. The toolkit contains extensive support in all these areas, presented in a way that requires minimal effort to use, and reduces your overall workload while ensuring that your application is a good command line citizen and has all the features command line users expect.
Console output can be word wrapped, and formatted into tables with full control over the formatting of table columns. The formatting services take the width of the console output window into account and will size table columns intelligently to make sure the output is readable.
Colours can be applied with exceptionally simple extension methods. For example:
console.WrapLine($"Displaying data from: {source.Yellow()}");
Instead of:
Console.Write("Displaying data from: ");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(source);
Console.ForegroundColor = ConsoleColor.White;
Input can be accepted from the user in a variety of ways from a simple confirmation question:
if (console.Confirm("Are you sure?"))
{
...
To more advanced use cases involving accepting whole data structures worth of data or presenting menus.
Command line parameters can be specified using a straightforward attribute based mechanism in which you define a command class and decorate it to specify which of its properties represent parameters and options. For example:
[Command]
[Description("List directories")]
public class DirCommand
{
[Positional]
[Description("Optional path to list.")]
public string Path { get; set; }
[CommandHandler]
public void Handle(IConsoleAdapter console, IErrorAdapter error)
{
console.FormatTable(Directory.EnumerateFileSystemEntries(Path).Select(d => new { Directory = d }));
}
}
Attributes in the command definition are used to automatically generate command line help and to automatically validate the arguments supplied on the command line. No further work is required beyond defining the command handler class.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. 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. |
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 | 13,676 | 8/26/2018 |
1.4.1 | 1,975 | 2/8/2018 |
1.4.0-beta3 | 1,099 | 12/31/2017 |
1.4.0-beta2 | 924 | 11/23/2017 |
1.4.0-beta1 | 1,115 | 11/19/2017 |
1.3.4 | 1,318 | 11/8/2017 |
1.3.3 | 1,296 | 11/3/2017 |
1.3.2 | 1,290 | 10/29/2017 |
1.3.1 | 1,194 | 9/23/2017 |
1.3.0-beta3 | 1,126 | 9/5/2017 |
1.3.0-beta2 | 1,061 | 8/20/2017 |
1.3.0-beta | 926 | 8/20/2017 |
1.2.0 | 1,545 | 12/11/2016 |
1.2.0-beta3 | 1,041 | 12/10/2016 |
1.2.0-beta2 | 1,036 | 12/5/2016 |
1.2.0-beta | 1,039 | 12/2/2016 |
1.1.0 | 1,419 | 6/27/2016 |
1.0.1 | 1,705 | 7/9/2015 |
1.0.0.27 | 1,537 | 7/4/2015 |
1.0.0.26 | 1,515 | 6/19/2015 |
1.0.0.25 | 1,548 | 5/12/2015 |
Support for interactive command sessions.