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.
<ItemGroup>
<PackageReference Include="Nullean.Argh" />
</ItemGroup>
var app = new ArghApp();
app.Map("hello", MyHandlers.SayHello);
return await app.RunAsync(args);
Use Nullean.Argh.Hosting when your app is built on Microsoft.Extensions.Hosting and you want DI, lifetimes, and host integration.
<ItemGroup>
<PackageReference Include="Nullean.Argh.Hosting" />
</ItemGroup>
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddArgh(args, b =>
{
b.Map("hello", MyHandlers.SayHello);
});
await builder.Build().RunAsync();
| 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 |