NextGenSoftware.CLI.Engine
2.0.3
dotnet add package NextGenSoftware.CLI.Engine --version 2.0.3
NuGet\Install-Package NextGenSoftware.CLI.Engine -Version 2.0.3
<PackageReference Include="NextGenSoftware.CLI.Engine" Version="2.0.3" />
<PackageVersion Include="NextGenSoftware.CLI.Engine" Version="2.0.3" />
<PackageReference Include="NextGenSoftware.CLI.Engine" />
paket add NextGenSoftware.CLI.Engine --version 2.0.3
#r "nuget: NextGenSoftware.CLI.Engine, 2.0.3"
#:package NextGenSoftware.CLI.Engine@2.0.3
#addin nuget:?package=NextGenSoftware.CLI.Engine&version=2.0.3
#tool nuget:?package=NextGenSoftware.CLI.Engine&version=2.0.3
NextGenSoftware.CLI.Engine
A feature-rich CLI engine for .NET — colour output, animations, spinners, tables, progress bars, ASCII art, interactive prompts, non-interactive / CI mode, and more. The terminal backbone of the OASIS Omniverse ecosystem, used in HoloNET, the OASIS API CLI, STAR ODK, and OurWorld.
Part of the OASIS Omniverse v2.0 Reboot. Visit oasisomniverse.one.
Installation
dotnet add package NextGenSoftware.CLI.Engine
Global Properties
CLIEngine.SuccessMessageColour = ConsoleColor.Green; // default
CLIEngine.ErrorMessageColour = ConsoleColor.Red; // default
CLIEngine.WarningMessageColour = ConsoleColor.DarkYellow;// default
CLIEngine.WorkingMessageColour = ConsoleColor.Yellow; // default
CLIEngine.SupressConsoleLogging = false; // set true to silence all output
CLIEngine.NonInteractive = false; // set true for CI / shell mode
CLIEngine.AssumeYes = false; // auto-yes for GetConfirmation in NonInteractive
CLIEngine.JsonOutput = false; // flag for JSON-line host apps
CLIEngine.Quiet = false; // suppress banners/donation messages
CLIEngine.MaxHolonSearchResults = 0; // 0 = unlimited
CLIEngine.ErrorHandlingBehaviour = ErrorHandlingBehaviour.OnlyThrowExceptionIfNoErrorHandlerSubscribedToOnErrorEvent;
Events
CLIEngine.OnError += (sender, e) => {
Console.WriteLine($"CLIEngine error: {e.Reason}");
Console.WriteLine(e.ErrorDetails);
};
Output Methods
ShowMessage
CLIEngine.ShowMessage("Hello world"); // yellow, with leading blank line
CLIEngine.ShowMessage("Done.", ConsoleColor.Cyan); // custom colour
CLIEngine.ShowMessage("Inline", lineSpace: false, noLineBreaks: true); // no newline appended
CLIEngine.ShowMessage("Indented", intendBy: 4); // extra indent spaces
CLIEngine.ShowMessage("After gap", addLineBefore: true); // blank line before message
ShowSuccessMessage / ShowErrorMessage / ShowWarningMessage
CLIEngine.ShowSuccessMessage("All packages published!");
CLIEngine.ShowErrorMessage("Connection failed.", addLineBefore: true);
CLIEngine.ShowWarningMessage("Proceeding with defaults.");
ShowDivider
CLIEngine.ShowDivider(); // 119 "*" characters
CLIEngine.ShowDivider("-", 80); // 80 dashes
CLIEngine.ShowDivider("=", 60, lineSpace: false);
DisplayProperty
CLIEngine.DisplayProperty("Status", "Connected", displayFieldLength: 20);
// Output: Status: Connected
CLIEngine.DisplayProperty("Version", "4.0.0", 20, displayColon: false);
Working Message Spinner
Displays a message then starts an animated spinner on the same line. EndWorkingMessage stops the spinner and prints a result on the same line.
CLIEngine.BeginWorkingMessage("Connecting to Holochain conductor...");
await client.ConnectAsync();
CLIEngine.EndWorkingMessage("DONE"); // prints " DONE" on the same line
// Or with a custom colour:
CLIEngine.BeginWorkingMessage("Loading data...", ConsoleColor.Cyan);
var data = await LoadDataAsync();
CLIEngine.EndWorkingMessage("Loaded.", ConsoleColor.Green);
ShowWorkingMessage (lower level)
CLIEngine.ShowWorkingMessage("Processing...");
// ... do work ...
// spinner continues until next ShowMessage call or Spinner.Stop()
UpdateWorkingMessage / UpdateWorkingMessageWithPercent
CLIEngine.BeginWorkingMessage("Uploading...");
for (int i = 0; i <= 100; i += 10)
{
await Task.Delay(200);
CLIEngine.UpdateWorkingMessageWithPercent(i);
}
CLIEngine.EndWorkingMessage("Complete.");
CLIEngine.UpdateWorkingMessage("Still going...", ConsoleColor.Cyan);
| Method | Description |
|---|---|
BeginWorkingMessage(string) |
Print message + start spinner; cursor stays on same line |
BeginWorkingMessage(string, ConsoleColor) |
Same with custom colour |
ShowWorkingMessage(string) |
Print yellow working message + start spinner |
ShowWorkingMessage(string, ConsoleColor) |
Same with custom colour |
UpdateWorkingMessage(string) |
Replace working message in-place without stopping spinner |
UpdateWorkingMessageWithPercent(int) |
Write NN% inline next to the spinner |
EndWorkingMessage(string) |
Stop spinner, print result on same line |
EndWorkingMessage(string, ConsoleColor) |
Same with custom colour |
Progress Bar
for (double i = 0; i <= 1.0; i += 0.1)
{
CLIEngine.ShowProgressBar(i); // 0.0 – 1.0
await Task.Delay(200);
}
CLIEngine.DisposeProgressBar(); // clears bar from console
CLIEngine.DisposeProgressBar(clearText: false); // leaves final bar text visible
| Method | Description |
|---|---|
ShowProgressBar(double) |
Update ASCII progress bar (0.0–1.0); creates it on first call |
DisposeProgressBar(bool) |
Dispose the bar; clearText: false leaves final state visible |
ASCII Art Banner
CLIEngine.WriteAsciMessage("OASIS", System.Drawing.Color.Cyan);
| Method | Description |
|---|---|
WriteAsciMessage(string, Color) |
Renders large ASCII-art text using Colorful.Console |
Colour Helpers
CLIEngine.ShowColoursAvailable(); // lists all valid ConsoleColor names in their own colour
CLIEngine.PrintColour("DarkGreen"); // writes "DarkGreen" in dark green
Interactive Input Methods
All input methods throw CLIEngineNonInteractiveInputRequiredException when CLIEngine.NonInteractive = true.
Text Input
string name = CLIEngine.GetValidInput("Enter your name:");
string title = CLIEngine.GetValidTitle("Enter title (Mr/Mrs/Ms/Miss/Dr):");
string email = CLIEngine.GetValidInputForEmail("Enter email:");
Numeric Input
int count = CLIEngine.GetValidInputForInt("How many?");
int ranged = CLIEngine.GetValidInputForInt("Pick 1–10:", checkForLowestOrHighestRange: true, lowest: 1, highest: 10);
long big = CLIEngine.GetValidInputForLong("Enter a large number:");
double rate = CLIEngine.GetValidInputForDouble("Enter rate:");
decimal price = CLIEngine.GetValidInputForDecimal("Enter price:");
Guid id = CLIEngine.GetValidInputForGuid("Enter GUID:");
Date Input
DateTime date = CLIEngine.GetValidInputForDate("Enter date (yyyy-mm-dd):");
// Type "exit" or "none" to cancel and return DateTime.MinValue
Enum Input
object result = CLIEngine.GetValidInputForEnum("Choose log level:", typeof(LogType));
LogType level = (LogType)result;
// Shows all valid enum values automatically; re-prompts on invalid input
Boolean / Confirmation
bool yes = CLIEngine.GetConfirmation("Are you sure? (Y/N)");
// Returns AssumeYes when NonInteractive = true
Password Input
string password = CLIEngine.GetValidPassword();
// Prompts twice, masks input with *, requires matching entries
string pw = CLIEngine.ReadPassword("Enter master password:");
// Single masked read
File and Folder Input
string folder = CLIEngine.GetValidFolder("Enter folder path:", createIfDoesNotExist: true);
string file = CLIEngine.GetValidFile("Enter file path:");
byte[] bytes = CLIEngine.GetValidFileAndUpload("Select file to upload:");
URI Input
Uri uri = await CLIEngine.GetValidURIAsync("Enter URL:", checkFileExists: true);
// Validates format and optionally does an HTTP HEAD to confirm resource exists
Colour Picker
ConsoleColor fav = ConsoleColor.Blue;
ConsoleColor cli = ConsoleColor.Green;
CLIEngine.GetValidColour(ref fav, ref cli);
// Interactive wizard: pick favourite colour + CLI display colour, with confirmation loop
Spinner (standalone)
var spinner = new Spinner();
spinner.Colour = ConsoleColor.Cyan;
spinner.Sequence = @"/-\|"; // animation frames
spinner.Delay = 100; // ms per frame
spinner.Start(); // auto-positions at current cursor
spinner.Start(left: 20, top: 5, delay: 80); // explicit position
spinner.Stop();
spinner.Dispose();
// CLIEngine.Spinner is a shared singleton:
CLIEngine.Spinner.Colour = ConsoleColor.Magenta;
| Property | Description |
|---|---|
Sequence |
Animation characters (default /-\|) |
Delay |
Frame delay in milliseconds (default 100) |
Colour |
Spinner character colour (default Green) |
IsActive |
Whether the spinner thread is running |
Left / Top |
Console cursor position for spinner character |
Animations
var anim = new Animations();
// Rotating spinner character at current position:
anim.Turn("Loading");
// Matrix-style grid animation at a fixed console position:
anim.SequencedMatrix(row: 5, column: 10, width: 8, height: 4);
// ASCII loading bar at a fixed position:
anim.LoadingBar("Loading", row: 3, column: 0);
anim.Ready(); // advance frame counter + sleep 75ms
// Simple inline spinner:
var spin = new ConsoleSpiner();
spin.Turn(); // writes one frame character and backtracks cursor
ConsoleHelper (Windows — Font Control)
var fontInfo = ConsoleHelper.SetCurrentFont("Lucida Console", fontSize: 16);
// Returns FontInfo[] { before, set, after }
| Method | Description |
|---|---|
SetCurrentFont(string, short) |
Sets console font via Win32 SetCurrentConsoleFontEx; returns before/set/after snapshots |
Exceptions
| Type | Description |
|---|---|
CLIEngineException |
Thrown by internal error handler when no OnError subscriber exists (or AlwaysThrowExceptionOnError is set) |
CLIEngineNonInteractiveInputRequiredException |
Thrown by any input method when CLIEngine.NonInteractive = true |
ErrorHandlingBehaviour
| Value | Description |
|---|---|
AlwaysThrowExceptionOnError |
Always throw CLIEngineException on internal error |
OnlyThrowExceptionIfNoErrorHandlerSubscribedToOnErrorEvent |
Throw only if OnError has no subscribers (default) |
NeverThrowExceptions |
Fire OnError event only, never throw |
MIT — Copyright © NextGen Software Ltd 2019 - 2026
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- BetterConsoleTables (>= 1.1.3)
- Colorful.Console (>= 1.2.15)
- ConsoleTables (>= 2.6.2)
- NextGenSoftware.ErrorHandling (>= 2.0.3)
- NextGenSoftware.Utilities (>= 2.0.3)
- ShellProgressBar (>= 5.2.0)
-
net8.0
- BetterConsoleTables (>= 1.1.3)
- Colorful.Console (>= 1.2.15)
- ConsoleTables (>= 2.6.2)
- NextGenSoftware.ErrorHandling (>= 2.0.3)
- NextGenSoftware.Utilities (>= 2.0.3)
- ShellProgressBar (>= 5.2.0)
-
net9.0
- BetterConsoleTables (>= 1.1.3)
- Colorful.Console (>= 1.2.15)
- ConsoleTables (>= 2.6.2)
- NextGenSoftware.ErrorHandling (>= 2.0.3)
- NextGenSoftware.Utilities (>= 2.0.3)
- ShellProgressBar (>= 5.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on NextGenSoftware.CLI.Engine:
| Package | Downloads |
|---|---|
|
NextGenSoftware.Logging
A flexible, pluggable logging library with a clean ILogger/ILogProvider abstraction used across the entire NextGen Software ecosystem (OASIS, HoloNET, STAR). Supports multiple simultaneous log providers -- console, file, NLog, and custom implementations. Configurable log levels, formatting, and async log dispatch. Part of the OASIS Omniverse ecosystem at https://oasisomniverse.one -- Source: https://github.com/NextGenSoftwareUK/NextGenSoftware-Libraries |
|
|
NextGenSoftware.OASIS.STAR.CLI.Lib
Core library for the STAR ODK command-line interface — exposes all STAR CLI commands as a reusable library so they can be embedded in other tools and UIs. |
GitHub repositories
This package is not used by any popular GitHub repositories.
## v2.0.1 — OASIS Omniverse Reboot (2026)
Part of the biggest NextGen Software release in years! The full OASIS Omniverse ecosystem — powering Our World, the OASIS API (85+ NuGet packages), HoloNET (Holochain .NET client), STAR ODK, and more — has been fully relaunched and rebranded at https://oasisomniverse.one/
After years of continuous development this is the first major v2 release, representing a complete overhaul and modernisation of the entire NextGen Software foundation.
### What's New in v2.0.1
- Added .NET 10 support: now multi-targeting net8.0, net9.0, and net10.0 for future-proof compatibility
- Copyright updated: NextGen Software Ltd 2019 - 2026
- Part of the unified OASIS Omniverse ecosystem at https://oasisomniverse.one/
- Added BeginWorkingMessage/EndWorkingMessage for animated long-operation feedback with inline DONE confirmation
- Added nextMessageOnSameLine to all ShowMessage overloads
- Added SupressConsoleLogging property to toggle console output at runtime
- Integrated NextGenSoftware.ErrorHandling for structured exception reporting
- Improved cross-platform rendering compatibility (Linux, macOS, Windows)
- Significantly improved error handling, robustness, and API consistency
- Multiple bug fixes and stability improvements
- Open source under MIT licence — https://github.com/NextGenSoftwareUK/NextGenSoftware-Libraries