SiroccoCLIFx 1.2.0
dotnet add package SiroccoCLIFx --version 1.2.0
NuGet\Install-Package SiroccoCLIFx -Version 1.2.0
<PackageReference Include="SiroccoCLIFx" Version="1.2.0" />
<PackageVersion Include="SiroccoCLIFx" Version="1.2.0" />
<PackageReference Include="SiroccoCLIFx" />
paket add SiroccoCLIFx --version 1.2.0
#r "nuget: SiroccoCLIFx, 1.2.0"
#:package SiroccoCLIFx@1.2.0
#addin nuget:?package=SiroccoCLIFx&version=1.2.0
#tool nuget:?package=SiroccoCLIFx&version=1.2.0
SiroccoCLIFx
A lightweight, feature-rich .NET library for building beautiful console applications.
SiroccoCLIFx v1.2.0 Release Notes
Major stability & correctness update. All 1.0.x / 1.1.x users are advised to upgrade.
Features
None
Bug Fixes
ConsoleFxCJK/Emoji width �� FixedWrapTextandWriteWrappedto correctly calculate display width for CJK/Emoji characters (count as 2 columns), preventing misaligned wrapping.ConsoleFxANSI stripping �� AddedStripAnsito remove escape sequences before width calculation, avoiding interference from color codes.ConsoleFxstyle state stack ��SetForeground/SetBackgroundnow push/pop state via_styleStateStack, allowingResetStylesto restore previous colors without pollution.ConsoleFxFilter exceptions �� Exceptions inFilterdelegate are now caught and logged (Debug only), no longer crashing or blocking output.- Windows fallback �� On legacy Windows terminals without VT support, true color is disabled and falls back to 16-color mode to prevent garbage output.
- Terminal mode restoration �� Original console mode is restored on process exit (including Ctrl+C), preventing permanent color corruption.
MenuSelectornon?interactive fallback �� When stdin is redirected,Selectfalls back to plain numeric selection, avoidingInvalidOperationException.MenuSelectorsafe window size ��Console.WindowWidth/Heightnow fall back to 80x24 when output is redirected, preventing exceptions.MenuSelectorscreen cleanup �� Menu exit now clears all rows with correct width, leaving no stray characters.MenuSelectorprompt control �� Thepromptparameter now only outputs when non?null;nullmeans no prompt, giving full caller control.MenuSelectorlayout offset ��linesWrittennow correctly increments only when output is actually written, fixing title/menu alignment.Chartvertical bar labels ��BarChartOrientation.Verticalnow displays numeric labels above bars.Chartline chart ��DrawLineChartis now fully implemented (was a stub).Chartsafe window size ��DrawBarChartuses safe terminal dimension reads to avoid exceptions in redirected environments.ProgressTrackerbottom mode infinite recursion �� FixedStackOverflowExceptionwhen logging occurred withEnableBottomModeenabled.ProgressTrackerredirect protection ��EnableBottomModenow returns early when output is redirected, preventing log pollution.ProgressTrackertrailing cleanup ��DrawProgressBarCoreuses safe width values to clear trailing characters.ArgumentParserbool Required ��[Option(Required = true)]now correctly validatesboolproperties (checks if explicitly set, not value).ArgumentParsercollection Required �� Requiredstring[]/List<T>options now accept empty collections as explicitly provided, no longer falsely reporting missing.ArgumentParserpositional Required ��[Value(Required = true)]now correctly enforces required positional parameters.- **
Obsolete methods** ��ForceSplitandFindBestSplitmarked[Obsolete]` to prevent accidental use. ArgumentParserJSON/XML value retention ��ParseFromJsonandParseFromXmlnow preserve values from config files even whenApplyDefaultsruns; only command-line overrides take effect.ProgressTrackerimmediate progress refresh ��Updatenow redraws the progress bar immediately in bottom mode, preventing stale 0% display.ProgressTrackerlog emission �� FixedOnLogWrite/OnLogWriteLineto ensure logs are emitted without being swallowed, using proper locking and original output stream.ProgressTrackerspinner deadlock ��RunWithSpinnerandRunWithSpinnerAsyncno longer deadlock due to nested locks; spinner tasks run without holding the main lock.ParserContextcollection defaults ��ApplyDefaultsnow correctly instantiatesList<T>for interface types likeIList<T>andIEnumerable<T>.ConsoleFxcolor state isolation ��SetForeground/SetBackgroundnow use an internal style stack to prevent interference withWritestyle scopes.ProgressTrackerbottom mode cursor positioning �� Fixed off-by-one clearing of the progress line, ensuring no stray characters remain.ArgumentParsersubcommand set tracking �� Subcommand instances now correctly track which properties were set, fixingRequires/Excludesvalidation for nested commands.
Upgrade Recommended
dotnet add package SiroccoCLIFx --version 1.2.0
If you encounter any new issues, please submit them on GitHub Issues. https://github.com/Ricespoon-y/SiroccoCLIFx/
Overview
SiroccoCLIFx is a lightweight .NET library that supercharges your console applications with:
- True color support (with automatic fallback to 16 colors)
- Bold and italic text styles
- Customizable progress bars with weighted branches and ETA estimation
- Interactive menus with keyboard navigation (arrow keys, PageUp/PageDown)
- Command-line argument parsing with nesting, dependencies, and JSON/XML config loading
- Smart text wrapping (auto-break at punctuation)
- Spinner animations for long-running operations
- Output filtering and thread-safe operations
- Charting & Plotting �V Draw function curves, bar charts (horizontal/vertical), and line charts with customizable colors and styles.
- Hyperlinks �V Output clickable links (OSC 8) supported by modern terminals.
- Underline style �V Use
TextStyle.Underlinefor underlined text.
All functionality is exposed via clean, intuitive APIs, and the library has zero external dependencies (only System.Text.Json for JSON support, which is built into .NET Core 3.0+).
Features
| Feature | Description |
|---|---|
| ** Colors & Styles** | 16 standard colors + 256-color RGB (true color) with bold/italic support |
| ** Progress Bars** | Weighted branches, auto-subtract unfinished branches, ETA (5-second sliding window) |
| ** Interactive Menus** | Arrow-key navigation with custom selected/normal styles, page up/down support |
| ** Argument Parsing** | Short/long options, positional values, subcommands, dependencies, and validation |
| ** Smart Wrapping** | Word?wrap that prefers breaking at punctuation (full/half?width) |
| ** Spinner** | Animated spinner for async/sync operations, fixed?row refresh |
| ** Output Filtering** | Filter lines by content (e.g., hide sensitive data) |
| ** Thread?safe** | All output operations are internally locked for safe multi?threading |
| ** Charting** | Draw function curves, bar charts (horizontal/vertical), and line charts with customizable colors and styles. |
Installation
Via NuGet
dotnet add package SiroccoCLIFx
Via source
- Clone the repository and build:
- git clone https://github.com/Ricespoon-y/SiroccoCLIFx.git
- cd SiroccoCLIFx
- dotnet build -c Release
- Then reference the DLL in your project.
Quick Start
1. Colored Output
using SiroccoCLIFx;
ConsoleFx.WriteLine("Hello, World!", new TextStyle(
foreground: ConsoleColorEx.BrightGreen,
bold: true,
italic: true
));
// RGB color (if terminal supports true color)
ConsoleFx.WriteLine("RGB Text", new TextStyle(foreground: Color.FromRgb(255, 128, 64)
));
2. Progress Bar with Branching
using SiroccoCLIFx.Progress;
using var progress = new ProgressTracker();
using (var branch = progress.Branch(100)) // total weight = 100
{
for (int i = 0; i < 50; i++)
{
branch.Update(2); // each step = 2 weight
progress.DrawProgressBarAtRow(row: 3, width: 40, fillStr: "=");
Thread.Sleep(50);
}
} // leftover branch weight is automatically removed
3. Bottom-Mode Progress Bar (No Flicker)
using SiroccoCLIFx.Progress;
using var progress = new ProgressTracker();
progress.EnableBottomMode(width: 50, fillStr: "=", emptyStr: "-");
for (int i = 0; i <= 100; i++)
{
Console.WriteLine($"Processing item {i}...");
progress.Update(1);
Thread.Sleep(30);
}
Console.WriteLine("All done!"); // appears right after the 100% bar
4. Interactive Menu
string[] options = { "Option A", "Option B", "Option C" };
int choice = MenuSelector.Select(
options: options,
defaultIndex: 0,
title: "Please select:",
selectedStyle: new TextStyle(
foreground: ConsoleColorEx.BrightYellow,
background: ConsoleColorEx.DarkBlue,
bold: true
)
);
Console.WriteLine($"You chose: {options[choice]}");
5. Argument Parsing
using SiroccoCLIFx.Parsing;
public class MyArgs
{
[Option("--input", "-i", Required = true)]
public string Input { get; set; }
[Option("--verbose", "-v")]
public bool Verbose { get; set; }
[Value(0)]
public string Source { get; set; }
}
var args = new[] { "--input", "data.txt", "--verbose", "source" };
var parsed = ArgumentParser.Parse<MyArgs>(args);
var errors = ArgumentParser.Validate(parsed);
6. Drawing a Function Curve
using SiroccoCLIFx.Charting;
Chart.Draw(
func: x => Math.Sin(x),
xMin: -5, xMax: 5,
width: 80, height: 20,
lineChar: '#',
axisColor: ConsoleColorEx.BrightBlack,
lineColor: ConsoleColorEx.BrightRed
);
7. Bar Chart
var data = new Dictionary<string, double>
{
["Apple"] = 85,
["Banana"] = 120,
["Cherry"] = 60,
["Date"] = 95
};
// Horizontal
Chart.DrawBarChart(data, width: 30, orientation: BarChartOrientation.Horizontal);
// Vertical with values
Chart.DrawBarChart(data, width: 20, orientation: BarChartOrientation.Vertical, showValues: true);
8. Line Chart
var points = new List<(double x, double y)>();
for (int i = 0; i < 100; i++)
{
double x = i / 10.0;
points.Add((x, Math.Sin(x)));
}
Chart.DrawLineChart(points, width: 40, height: 10, lineChar: '*');
9. Spinner Animation
using var progress = new ProgressTracker();
progress.RunWithSpinner("Processing...", () =>
{
Thread.Sleep(3000); // Simulate a long task
});
10. Hyperlink
ConsoleFx.WriteLink("Visit the repo", "https://github.com/Ricespoon-y/SiroccoCLIFx");
API Overview
ConsoleFx static class
Write(string text, TextStyle? style)Write colored/styled textWriteLine(string text, TextStyle? style)Write colored/styled text with newlineWriteWrapped(string text, int maxWidth, TextStyle? style)Auto-wrap textSetForeground(Color color)Set foreground colorSetBackground(Color color)Set background colorResetStyles()Reset all stylesWriteLink(string text, string url, TextStyle? style)Output clickable hyperlinkGetDisplayWidth(string text)Get the actual terminal display width (CJK/Emoji count as 2)TruncateToWidth(string text, int maxWidth, string suffix)Truncate text to fit a display widthFilterDelegate to filter output lines
ProgressTracker class
Branch(double weight)ReturnsIProgressBranchUpdate(double step)Root-mode updateDrawProgressBar(...)Draws progress bar on current lineDrawProgressBarAtRow(int row, ...)Draws on a fixed rowEnableBottomMode(...)New in 1.2.0 Fixes progress bar to bottom with no flickerDisableBottomMode()New in 1.2.0 Disables bottom modeRunWithSpinner(...)Synchronous spinnerRunWithSpinnerAsync(...)Asynchronous spinnerEstimateRemaining()ReturnsTimeSpan?ETA
MenuSelector static class
Select(string[] options, int defaultIndex, ...)Returns selected index
ArgumentParser static class
Parse<T>(string[] args)Parses into TParseFromJson<T>(string jsonPath, string[] args)Loads from JSON then overrides with CLIParseFromXml<T>(string xmlPath, string[] args)Same for XMLValidate<T>(T obj)Returns list of validation errors
Chart static class
Draw(...)Draws a function curveDrawBarChart(...)Draws a horizontal or vertical bar chartDrawLineChart(...)Draws a line chart from points
Changelog
[1.2.0] - 2026-08-31
ConsoleFxCJK/Emoji width �� FixedWrapTextandWriteWrappedto correctly calculate display width for CJK/Emoji characters (count as 2 columns), preventing misaligned wrapping.ConsoleFxANSI stripping �� AddedStripAnsito remove escape sequences before width calculation, avoiding interference from color codes.ConsoleFxstyle state stack ��SetForeground/SetBackgroundnow push/pop state via_styleStateStack, allowingResetStylesto restore previous colors without pollution.ConsoleFxFilter exceptions �� Exceptions inFilterdelegate are now caught and logged (Debug only), no longer crashing or blocking output.- Windows fallback �� On legacy Windows terminals without VT support, true color is disabled and falls back to 16-color mode to prevent garbage output.
- Terminal mode restoration �� Original console mode is restored on process exit (including Ctrl+C), preventing permanent color corruption.
MenuSelectornon?interactive fallback �� When stdin is redirected,Selectfalls back to plain numeric selection, avoidingInvalidOperationException.MenuSelectorsafe window size ��Console.WindowWidth/Heightnow fall back to 80x24 when output is redirected, preventing exceptions.MenuSelectorscreen cleanup �� Menu exit now clears all rows with correct width, leaving no stray characters.MenuSelectorprompt control �� Thepromptparameter now only outputs when non?null;nullmeans no prompt, giving full caller control.MenuSelectorlayout offset ��linesWrittennow correctly increments only when output is actually written, fixing title/menu alignment.Chartvertical bar labels ��BarChartOrientation.Verticalnow displays numeric labels above bars.Chartline chart ��DrawLineChartis now fully implemented (was a stub).Chartsafe window size ��DrawBarChartuses safe terminal dimension reads to avoid exceptions in redirected environments.ProgressTrackerbottom mode infinite recursion �� FixedStackOverflowExceptionwhen logging occurred withEnableBottomModeenabled.ProgressTrackerredirect protection ��EnableBottomModenow returns early when output is redirected, preventing log pollution.ProgressTrackertrailing cleanup ��DrawProgressBarCoreuses safe width values to clear trailing characters.ArgumentParserbool Required ��[Option(Required = true)]now correctly validatesboolproperties (checks if explicitly set, not value).ArgumentParsercollection Required �� Requiredstring[]/List<T>options now accept empty collections as explicitly provided, no longer falsely reporting missing.ArgumentParserpositional Required ��[Value(Required = true)]now correctly enforces required positional parameters.- Obsolete methods ��
ForceSplitandFindBestSplitmarked[Obsolete]to prevent accidental use. ArgumentParserJSON/XML value retention ��ParseFromJsonandParseFromXmlnow preserve values from config files even whenApplyDefaultsruns; only command-line overrides take effect.ProgressTrackerimmediate progress refresh ��Updatenow redraws the progress bar immediately in bottom mode, preventing stale 0% display.ProgressTrackerlog emission �� FixedOnLogWrite/OnLogWriteLineto ensure logs are emitted without being swallowed, using proper locking and original output stream.ProgressTrackerspinner deadlock ��RunWithSpinnerandRunWithSpinnerAsyncno longer deadlock due to nested locks; spinner tasks run without holding the main lock.ParserContextcollection defaults ��ApplyDefaultsnow correctly instantiatesList<T>for interface types likeIList<T>andIEnumerable<T>.ConsoleFxcolor state isolation ��SetForeground/SetBackgroundnow use an internal style stack to prevent interference withWritestyle scopes.ProgressTrackerbottom mode cursor positioning �� Fixed off-by-one clearing of the progress line, ensuring no stray characters remain.ArgumentParsersubcommand set tracking �� Subcommand instances now correctly track which properties were set, fixingRequires/Excludesvalidation for nested commands.
[1.1.2] - 2026-08-31
- Fixed
StackOverflowExceptioninProgressTracker.EnableBottomMode - Fixed boolean
[Option(Required = true)]validation inArgumentParser - Fixed
MenuSelectorcleanup leaving stray characters - Fixed
ValueAttribute.Requiredpositional parameter validation - Implemented
DrawLineChartmethod - Vertical bar charts now display numeric values
- Made
ConsoleFx.Filterthread-safe - Automatic terminal mode restore on process exit
- Added
EnableBottomModeandDisableBottomModeAPIs
[1.1.0] - 2026-08-19
- Added bottom-fixed progress bar mode
- Added charting module (function curves, bar charts)
- Added hyperlink support (OSC 8)
- Added spinner animations
- Fixed various progress bar edge cases
[1.0.0] - Initial release
- Basic colored output with
ConsoleFx - Progress tracker with branching
- Interactive menu selector
- Command-line argument parsing
Requirements
.NET Standard 2.0 or later (.NET Core 3.0+, .NET 5/6/7/8, .NET Framework 4.6.2+)
A modern terminal that supports ANSI escape codes (Windows Terminal, iTerm2, etc.) for full color experience.
Contributing
Pull requests and issues are welcome! Please ensure you follow the existing code style and add tests where applicable.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Enjoy building better console apps with SiroccoCLIFx!
| Product | Versions 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. net9.0 was computed. 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 was computed. 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. |
| .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. |
-
.NETStandard 2.0
- System.Text.Json (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.