Consolix 1.1.0

dotnet add package Consolix --version 1.1.0
NuGet\Install-Package Consolix -Version 1.1.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="Consolix" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Consolix --version 1.1.0
#r "nuget: Consolix, 1.1.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 Consolix as a Cake Addin
#addin nuget:?package=Consolix&version=1.1.0

// Install Consolix as a Cake Tool
#tool nuget:?package=Consolix&version=1.1.0

Consolix

Console applications are quick way to have something done either as a supporting tool in bigger project or something handy to run from time-to-time. Unfortunately the possibilities of console application and default Visual Studio template leaves space for many improvements, which are covered in this console extensions package.

There are numerous packages covering some of aspects (color console, spinner, progress bar, input helpers, command and parameter parsers) and they are more extensive in that one thing they do. This package takes minimum necessary for simple tooling/app build and packs all these things in one convenient package.

To use commands and parameter parsing/mapping to command properties, package expects console application to be created as hosted application (introduced in .Net Core), using dependency injection and other possibilities usually available by default in ASP.NET applications. This includes logging availability and configuration file usage, too.

Package provides:

  • Creating console commands as separate classes based on provided interface:
    • Necessary command parameter wiring via attribute use on command class properties (read/mapped from command line or from configuration file).
    • Automated validation of parameters and their presence (if mandatory).
    • Automated command(s) on-screen help generation.
    • One (default to run) or multiple command (specify in command line) possibility.
  • Output helpers (with colors!):
    • Simple output coloring (both foreground and background colors).
    • String.Format placeholders bi-coloring.
    • Clear console line, overwrite current console line.
    • Setting predefined color scheme from 4 available in package.
    • Simple menu.
    • Busy indicator (spinner) for long process visualization (does not block working thread).
      • Working status messages along with spinner.
      • Elapsed time display for process.
      • Inline Progress bar.
    • Progress bar
      • Based on currentStep/totalSteps (not percentage!).
      • Shows execution time along with % done.
  • Input helpers:
    • Password input (entered characters replaced with asterisk (*) on screen).
    • Wait for specific keys.
    • Wait for Enter
    • Wait for Escape.
    • Wait for y/n.

Examples

Parameter wiring

Assume we have this cmdline invoking of application:

C:>consoleapp.exe command --start 2022-01-21 --times 10 --deep

This requires these parameters to be assigned to properties in command with appropriate types.
Package allows to do that easily:

[ConsoleOption("start", "Help text", "s")]
public DateTime? StartDate { get; set; }

[ConsoleOption("times", "Help text", "t")]
public int? TimesToRun { get; set; }

[ConsoleOption("deep", "Help text", "d")]
public bool? GoDeep { get; set; }
Spinner (here growing arrow) with elapsed time and status messages

Spinner with time and status messages

Progress bar

Progress bar

Simple menu

Output coloring

Output coloring

Command auto-help

Command auto-help

Color scheme choices (here: Raspberry)

Raspberry color scheme

Documentation

Repository Wiki has usage documentation and code snippets for package use.

Demo (Sample) project

Repository includes a sample (Demo) project to visualize its possibilities and usage patterns.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.0 250 3/9/2023
1.0.1 230 3/5/2023
1.0.0 296 1/29/2022

Added CursorPosition class. Positional output methods. Progress bar sample updated with positional info output.