Skip to main content

A terminal UI framework for .NET. Views are plain classes, navigation keeps a history, and everything is wired through Microsoft.Extensions.DependencyInjection.

dotnet add package Arlecchino

The shortest application

using MyApp.Navigation; // where the generator puts ViewKind and AddGeneratedViews

var builder = Host.CreateApplicationBuilder(args);

builder.Services
.AddArlecchino(options => options.MinimumWidth = 60)
.AddGeneratedViews()
.AddGeneratedStores()
.AddGeneratedCommands()
.StartAt(ViewKind.Default);

await builder.Build().RunAsync();

The first view

public class DefaultView : IArlecchinoView
{
private readonly Surface _surface;

public DefaultView(Surface surface) => _surface = surface;

public void Draw()
{
_surface.AppendLine("hello", Theme.Header, Align.Center);
}

public ViewRoute Handle(ConsoleKeyInfo key) =>
key.Key == ConsoleKey.A ? ViewKind.About : ViewRoute.None;

public (string Key, string Description)[] Hints() => [("a", "about")];
}

What it looks like

Arlecchino.Commander is a file manager built on the framework: two panels over local disks, SFTP and FTP, tabs, leader keys, a command line under the panels, a walk that searches names and the text inside files, copies that run in the background and report themselves, and a palette that reaches all of it by name.

Two panels over a local disk