QuiCLI 0.5.4

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

QuiCLI

.NET Publish CodeQL

A lightweight framework for creating CLI applications with the primary focus of being compatible with AOT and trimming. This is to generate small and fast self-contained executables.

Because of the restrictions imposed by trimming and AOT, the framework is designed to be as simple as possible. This means that it does not support certain features that are common in other CLI frameworks that requires extensive reflection.

The framework is built on top of Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Configuration, which means that it is possible to use the same configuration and dependency injection system as in ASP.NET Core.

As an example of an application that uses QuiCLI, see SecurityCenterCLI and RFDump.

Features

  • Dependency injection
  • Command line argument parsing
  • Command line argument help generation
  • Command line argument type conversion
  • Nested command groups

Quick start

Note: The framework is still in early development, and the API is subject to change.

The only supported returns types for asynchronous commands are Task<object>, Task<string> and Task due to reflection restrictions. For synchronous commands, everything is supported.

Registration of commands is explicit by design to make the code as efficient and clear as possible without heavy reflection usage.

dotnet add package QuiCLI


using Microsoft.Extensions.DependencyInjection;
using QuiCLI;
using SampleApp;

var builder = QuicApp.CreateBuilder();
builder.Configure(config => config.CustomBanner = () => "Welcome to SampleApp!");
builder.Services.AddTransient<GreeterService>();

builder.Commands.Add<HelloCommand>()
    .WithCommand("hello", x => x.Hello)
    .WithCommand("bye", x => x.Bye);

var informalGroup = builder.Commands.WithGroup("informal");

informalGroup
    .Add<InformalGreetings>()
    .WithCommand("sup", x => x.Sup)
    .WithCommand("hey", x => x.Hey);

informalGroup
    .Add<InformalGoodbyes>()
    .WithCommand("cya", x => x.Cya)
    .WithCommand("later", x => x.Later);

var app = builder.Build();

app.Run();



using QuiCLI.Command;

namespace SampleApp;

internal class HelloCommand(GreeterService greeterService)
{
    private readonly GreeterService _greeterService = greeterService;

    public string Hello(
        [Parameter(help: "Which name to greet")] string name,
        [Parameter(help: "Define which year should be displayed")] int year = 2024)
    {
        return $"Hello, {name}! Welcome to {year}!";
    }

    public string Bye(string name)
    {
        return _greeterService.SayGoodbye(name);
    }
}
myapp hello --name "World"
sampleapp.exe --help

Welcome to SampleApp!
Usage:
  <command> [arguments]

Commands:
        hello
        bye

Nested Commands:
        informal

Global Arguments:
        --help          :       Show help information
        --output        :       Output format
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. 
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
0.5.4 137 8/30/2024
0.5.3 119 8/29/2024
0.5.2 120 8/29/2024
0.5.1 125 8/29/2024
0.5.0 123 8/29/2024
0.4.1 157 8/26/2024
0.4.0 135 8/26/2024
0.3.5 165 8/9/2024
0.3.4 139 8/9/2024
0.3.3 87 8/5/2024
0.3.2 150 6/2/2024
0.3.1 139 6/1/2024
0.3.0 129 6/1/2024
0.2.3 123 6/1/2024
0.2.2 127 6/1/2024
0.2.1 129 6/1/2024
0.2.0 128 6/1/2024
0.1.0 130 6/1/2024
0.0.1 132 5/31/2024