CDS.CLIMenus 2.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CDS.CLIMenus --version 2.0.2
                    
NuGet\Install-Package CDS.CLIMenus -Version 2.0.2
                    
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="CDS.CLIMenus" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CDS.CLIMenus" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="CDS.CLIMenus" />
                    
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 CDS.CLIMenus --version 2.0.2
                    
#r "nuget: CDS.CLIMenus, 2.0.2"
                    
#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.
#addin nuget:?package=CDS.CLIMenus&version=2.0.2
                    
Install CDS.CLIMenus as a Cake Addin
#tool nuget:?package=CDS.CLIMenus&version=2.0.2
                    
Install CDS.CLIMenus as a Cake Tool

CDS.CLIMenus

CDS.CLIMenus is a library for creating very simple and quick console-app menus. It is great for simple demo and test applications.

It's available for .Net 8 and .Net Framework 4.8 console applications.

It will only save you 10-20 minutes of coding, but that leaves more time for the fun stuff!

In this release there is only a basic menu system, in the Basic namespace. Future release will include more advanced features.

Correction: this release prompts the user to hit any key after running the menu action. This feature was meant to be in the original release, but was accidentally left out!

Usage

Fluent API for Building Menus

The following example demonstrates how to use the fluent API to build and run a menu:

using CDS.CLIMenus.Basic; 
using ConsoleDemo;

new MenuBuilder("Main menu")
	.AddItem("Generate Prime Numbers", new PrimeNumberGenerator().Run) 
	.AddItem("Play High-Low Game", "Try to guess the number I'm thinking of!", new HighLowGame().Run) 
	.Build() 
	.Run();

Console Screenshot

Conventional API for Building Menus

Alternatively, you can use the conventional API to build and run a menu:

using .Basic; 
using ConsoleDemo;

var menuItems = new List<MenuItem>
{
    new("Generate Prime Numbers", () => new PrimeNumberGenerator().Run()),
    new("Play High-Low Game", "Try to guess the number I'm thinking of!", () => new HighLowGame().Run())
};

var menu = new Menu("Main Menu", menuItems);
menu.Run();

Build Instructions

Follow the standard practice for building a .Net project using Nerdbank.GitVersioning. The version.json file is automatically updated with the new version number, or can be manually updated for a major or minor version change.

License

This project is licensed under the MIT License.

Attributions

Number package icon, created by Freepik - Flaticon.

Product 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 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 Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • net8.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
2.0.3 169 3/31/2025
2.0.2 402 3/24/2025
2.0.0 104 3/21/2025
1.0.1 97 3/21/2025