Termino 1.1.0

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

// Install Termino as a Cake Tool
#tool nuget:?package=Termino&version=1.1.0                

Contents

Termino

A very simple but cool looking, customizable and interactive text UI for your console tools.

Installation

dotnet add package Termino

Interface interaction

You only need 3 keys to interact with it: Up, Down, Enter. Use the Up and Down arrow keys to navigate through options, then press Enter to select an option.

Customization

If you are not satisfied with the default theme you can tweak it's options using the Termino.Models.Themes.TerminoTheme class.

Some of the customization options are:

  • Colors (for title, options, currently selected option)
  • Top margin
  • Left margin
  • Options indicator character
  • Display/Hide cursor
  • Loop navigation between options

Code Examples


// Create an instance of TerminoUI
var terminoUI = new TerminoUI();

// Print a menu to the user
terminoUI.PrintMenu(TerminoMenu.Create("Choose an action", "Action 1", "Action 2", "Action 3"));

// Process the user selected option
var actionAnswer = terminoUI.ReadUserInput().Name;
switch (actionAnswer)
{
    case "Action 1":
        // TODO: Execute action 1
        break;

    case "Action 2":
        // TODO: Execute action 2
        break;
}

Change default theme options


// Create an instance of TerminoUI
var terminoUI = new TerminoUI();

// Declare a theme with custom options
var theme = new TerminoTheme
{
    TitleForegroundColor = ConsoleColor.DarkYellow
};

// Set the theme
terminoUI.SetTheme(theme);

// Print a menu to the user
terminoUI.PrintMenu(TerminoMenu.Create("Choose an action", "Action 1", "Action 2", "Action 3"));

// Process the user selected option
var actionAnswer = terminoUI.ReadUserInput().Name;
switch (actionAnswer)
{
    case "Action 1":
        // TODO: Execute action 1
        break;

    case "Action 2":
        // TODO: Execute action 2
        break;
}

Termino.Logging

  • Integrates Termino with with Microsoft.Extensions.Logging.
  • Supports structured logging.

Installation

dotnet add package Termino.Logging

Code Examples

Setup and use Termino and Termino.Logging in apps that use Host builder


var builder = Host.CreateApplicationBuilder(args);

// Add TerminoUI and Termino.Logging to the DI container
builder.Services.AddLogging(config =>
{
    config.AddTerminoLogging();
    config.SetMinimumLevel(builder.Configuration.GetValue<LogLevel>("MinimumLogLevel"));
});

var host = builder.Build();

// Manually get a new instace of Termino UI.
// Note: You can also inject it into your services
using var serviceScope = host.Services.CreateScope();
var terminoUI = serviceScope.ServiceProvider.GetRequiredService<TerminoUI>();

// Print a menu to the user
terminoUI.PrintMenu(TerminoMenu.Create("Choose an action", "Action 1", "Action 2", "Action 3"));

// Process the user selected option
var actionAnswer = terminoUI.ReadUserInput().Name;
switch (actionAnswer)
{
    case "Action 1":
        // TODO: Execute action 1
        break;

    case "Action 2":
        // TODO: Execute action 2
        break;
}

// Get from DI an ILogger<T> in your services (e.g. via dependency injection)
private readonly ILogger<MyService> _logger;

public MyService(ILogger<MyService> logger)
{
    _logger = logger;
}

// Log messages in TerminoUI
_logger.LogInformation("Hello {@name}.", name);

Donations

Be careful and donate only if it is within your possibilities, because there is no refund system! Remember that you don't need to donate! You can use however you want this product totally for free. Thank you!

<a href="https://buymeacoffee.com/arclight" target="_blank"><img src="https://buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

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 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Termino:

Package Downloads
Termino.Logging

Integrates Termino with Microsoft.Extensions.Logging

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 79 11/20/2024
1.0.2 119 10/18/2024
1.0.1 79 10/17/2024