cli-menu 1.0.4

dotnet add package cli-menu --version 1.0.4
                    
NuGet\Install-Package cli-menu -Version 1.0.4
                    
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="cli-menu" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cli-menu" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="cli-menu" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add cli-menu --version 1.0.4
                    
#r "nuget: cli-menu, 1.0.4"
                    
#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.
#:package cli-menu@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=cli-menu&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=cli-menu&version=1.0.4
                    
Install as a Cake Tool

cli-menu

Simple C# cli menu. Includes a table class for displaying data in a table format.

Installation

Use the package manager nuget to install cli-menu.

dotnet add package cli-menu

Usage

Basic Usage

using cli_menu;

// Create a new menu
Menu menu = new Menu("Main Menu");

// Add a menu option
menu.AddOption("Option 1", () => Console.WriteLine("Option 1 selected"));

// Display the menu
menu.Start();

Adding multiple options

// Add multiple options
menu.AddOptions(
    new Option("Option 1", () => Console.WriteLine("Option 1 was selected!")),
    new Option("Option 2", () => Console.WriteLine("Option 2 was selected!")),
    new Option("Option 3", () => Console.WriteLine("Option 3 was selected!"))
);

Add an option that will change if you change the value of a variable

// Create a variable
string option1 = "Option 1";

// Add a menu option
menu.AddOption(() => option1, () => {
    Console.WriteLine("Option 1 selected");
    option1 = "Option 1 selected";
});

Add a header

// Add a header
menu.Header = () => $"Current time is {DateTime.Now}";

The ConsoleTable class

Basic Usage

using cli_menu;

// Create a new table
ConsoleTable table = new ConsoleTable();

// Add columns
table.AddColumn("Column 1");

// Add rows
table.Append("Row 1");
table.Append("Row 2");

// Display the table
table.Display();

Adding multiple columns

// Add multiple columns
table.AddColumns("Column 1", "Column 2", "Column 3");

Adding multiple items to a row

// Add multiple items to a row
table.AddRow("Item 1", "Item 1", "Item 1");

Setting the table title

After creating the table
// Set the table title
table.Title = "Table Title";
When creating the table
// Set the table title
ConsoleTable table = new ConsoleTable("Table Title");

Localisation

Changing the language

// Change the language to French
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr-CA");

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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.4 252 12/21/2023
1.0.3 192 11/20/2023
1.0.2 153 11/19/2023
1.0.0 167 11/14/2023