Getting started

Nullean.Argh provides two entry points depending on your application model. Both share the same registration surface (Map, Map<T>, MapRoot, MapNamespace, etc.) and the same source generator. The difference is how the runtime is bootstrapped and whether DI is available.

Use Nullean.Argh directly with ArghApp for lightweight CLIs with no external dependencies.

Xml
<ItemGroup>
  <PackageReference Include="Nullean.Argh" />
</ItemGroup>
C#
var app = new ArghApp();
app.Map("hello", MyHandlers.SayHello);
return await app.RunAsync(args);

Console app quick start →

Use Nullean.Argh.Hosting when your app is built on Microsoft.Extensions.Hosting and you want DI, lifetimes, and host integration.

Xml
<ItemGroup>
  <PackageReference Include="Nullean.Argh.Hosting" />
</ItemGroup>
C#
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddArgh(args, b =>
{
    b.Map("hello", MyHandlers.SayHello);
});
await builder.Build().RunAsync();

Hosted app quick start →

Scenario Package
Simple CLI tool, no DI needed Nullean.Argh
App uses IHost, needs DI, logging, config Nullean.Argh.Hosting
Building a shared middleware/parser library Nullean.Argh.Interfaces