ConsoleFeatures 1.0.0

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

// Install ConsoleFeatures as a Cake Tool
#tool nuget:?package=ConsoleFeatures&version=1.0.0

ConsoleFeatures

A library that gives functionality to the console (Progressbar, selection menu, acceptance field)

<p align="center"> <img src="https://raw.githubusercontent.com/KimPiks/ConsoleFeatures/main/output.png" /> </p>

Docs

  • void Progressbar(int value, int min = 0, int max = 100, string information = "")<br> Shows a progressbar<br>

    • int value - Progressbar value
    • int min - Progressbar minimum value (default 0)
    • int max - Progressbar minimum value (default 100)
    • string information - Additional information (e.q. download speed)
    • ArgumentOutOfRangeException - The exception is returned when the progressbar value is outside its range (min < = value < = max)
  • int Selector(List<string> options, int selectedIndex = 0)<br> Shows a form with options to choose from<br>

    • List<string> options - List of options to choose from
    • int selectedIndex - Currently selected option, no need to specify, needed for recursion
    • Return - The index of the selected option
  • bool Acceptance(string text, bool approvalRequired = false)<br> Shows acceptable condition (Y/N)<br>

    • string text - Acceptable condition
    • bool approvalRequired - Whether the user must accept the terms to proceed
    • Return - Whether the user has accepted the terms
  • void ClearLastLine()<br> Clears the last console line

Example

using Console = ConsoleFeatures.Console;

System.Console.WriteLine("Progressbar");

Random rand = new();
for (var i = 0; i <= 100; i++)
{
    var downloadSpeed = rand.NextInt64(1, 20);
    Console.Progressbar(i, information: $"{downloadSpeed} Mb/s");
    Thread.Sleep(100);
}

System.Console.Write("\n");

System.Console.WriteLine("Selector");

var options = new List<string>()
{
    "First option",
    "Second option",
    "Third option"
};

var selectedOptionIndex = Console.Selector(options);
System.Console.WriteLine($"Selected option: {options[selectedOptionIndex]}");

System.Console.Write("\n");
System.Console.WriteLine("Acceptance");

var accepted = Console.Acceptance("Do you accept sth?");
System.Console.WriteLine(accepted.ToString());

System.Console.Write("\n");

Console.Acceptance("Do you accept sth? required", true);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • 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
1.0.0 188 2/1/2023