BosonWare.TerminalApp 2.2.1

dotnet add package BosonWare.TerminalApp --version 2.2.1
                    
NuGet\Install-Package BosonWare.TerminalApp -Version 2.2.1
                    
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="BosonWare.TerminalApp" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BosonWare.TerminalApp" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="BosonWare.TerminalApp" />
                    
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 BosonWare.TerminalApp --version 2.2.1
                    
#r "nuget: BosonWare.TerminalApp, 2.2.1"
                    
#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 BosonWare.TerminalApp@2.2.1
                    
#: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=BosonWare.TerminalApp&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=BosonWare.TerminalApp&version=2.2.1
                    
Install as a Cake Tool

BosonWare.TerminalApp

BosonWare.TerminalApp is a modern, extensible .NET terminal application framework designed to simplify the creation of interactive command-line tools. It provides a robust command registry, built-in commands, command history, and flexible parsing utilities, making it ideal for building rich terminal experiences.

Features

  • Command Registry: Easily register and manage commands with attributes and aliases.
  • Built-in Commands: Includes common commands like help, clear, exit, version, and time.
  • Command History: Persistent command history with disk storage.
  • Command Parsing: Advanced command-line parsing with support for quoted arguments.
  • Extensibility: Add custom commands by implementing the ICommand interface or deriving from Command<TOptions>.
  • Colorful Output: Integrates with BosonWare.TUI for styled console output.

Getting Started

Prerequisites

Installation

Add the NuGet package to your project:

dotnet add package BosonWare.TerminalApp

Example Usage

Create a simple terminal app:

using BosonWare.TerminalApp;
using BosonWare.TerminalApp.BuiltIn;

CommandRegistry.LoadCommands<Program>(typeof(IBuiltInAssemblyMarker));

var app = new ConsoleApplication() {
    Prompt = "[Crimson]Boson Terminal[/] > ",
    History = CommandHistory.CreateAsync("command_history.json").GetAwaiter().GetResult()
};

await app.RunAsync();

Registering Commands

Commands are registered using the [Command] attribute:

[Command("greet", Aliases = ["hello"], Description = "Greets the user.")]
public sealed class GreetCommand : ICommand
{
    public Task Execute(string arguments)
    {
        Console.WriteLine($"Hello, {arguments}!");
        return Task.CompletedTask;
    }
}

Or use options parsing:

public class EchoOptions
{
    [Option('u', "upper", HelpText = "Uppercase output.")]
    public bool Upper { get; set; }
}

[Command("echo", Description = "Echoes input.")]
public sealed class EchoCommand : Command<EchoOptions>
{
    public override Task Execute(EchoOptions options)
    {
        // Implementation here
        return Task.CompletedTask;
    }
}

Built-in Commands

  • help / info / -h / ? — Displays help
  • clear / cls — Clears the terminal
  • exit / shutdown — Exits the application
  • version / ver — Shows version info
  • time — Shows current time (--utc for UTC)

Command History

Command history is persisted to disk and loaded on startup. The default limit is 1000 entries.

License

MIT License. See LICENSE for details.

Contributing

Contributions are welcome! Please submit issues or pull requests via GitHub.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.

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.2.1 55 8/16/2025
2.2.0 51 8/16/2025
2.1.0 68 8/16/2025 2.1.0 is deprecated.
2.0.0 63 8/1/2025
1.2.0 197 7/19/2025
1.1.0 116 7/16/2025
1.0.0 93 7/12/2025

Added support for `GroupAttribute` on interfaces.