Albatross.CommandLine.Defaults 8.0.1-78.main

Prefix Reserved
This is a prerelease version of Albatross.CommandLine.Defaults.
This package has a SemVer 2.0.0 package version: 8.0.1-78.main+dc6b66d.
dotnet add package Albatross.CommandLine.Defaults --version 8.0.1-78.main
                    
NuGet\Install-Package Albatross.CommandLine.Defaults -Version 8.0.1-78.main
                    
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="Albatross.CommandLine.Defaults" Version="8.0.1-78.main" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Albatross.CommandLine.Defaults" Version="8.0.1-78.main" />
                    
Directory.Packages.props
<PackageReference Include="Albatross.CommandLine.Defaults" />
                    
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 Albatross.CommandLine.Defaults --version 8.0.1-78.main
                    
#r "nuget: Albatross.CommandLine.Defaults, 8.0.1-78.main"
                    
#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 Albatross.CommandLine.Defaults@8.0.1-78.main
                    
#: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=Albatross.CommandLine.Defaults&version=8.0.1-78.main&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Albatross.CommandLine.Defaults&version=8.0.1-78.main&prerelease
                    
Install as a Cake Tool

Albatross.CommandLine.Defaults

Optional package providing default integrations for common command-line application patterns

This package adds pre-configured integrations for configuration management and logging to Albatross.CommandLine applications. It eliminates boilerplate setup by providing sensible defaults for most command-line scenarios.

Quick Start

Install the package alongside Albatross.CommandLine:

<PackageReference Include="Albatross.CommandLine.Defaults" Version="..." />

Add .WithDefaults() to your command host setup:

using Albatross.CommandLine;
using Albatross.CommandLine.Defaults;

static async Task<int> Main(string[] args) {
    await using var host = new CommandHost("My CLI App")
        .RegisterServices(RegisterServices)
        .AddCommands()
        .Parse(args)
        .WithDefaults()  // <-- Adds config + logging defaults
        .Build();
    return await host.InvokeAsync();
}

What's Included

Configuration Support

  • JSON Configuration: Automatically loads appsettings.json and environment-specific variants
  • Environment Variables: Includes environment variable configuration provider
  • Environment Detection: Uses DOTNET_ENVIRONMENT for configuration file selection
  • DI Integration: Registers configuration services for dependency injection
  • Additional Documentation: Albatross.Config

Serilog Integration

  • Console Logging: Pre-configured console output with appropriate formatting
  • Verbosity Control: Respects the built-in --verbosity option from CommandBuilder
  • Level Mapping: Maps Microsoft.Extensions.Logging levels to Serilog levels
  • Zero Configuration: Works out-of-the-box with sensible defaults
  • Additional Documentation: Albatross.Logging

Verbosity-Aware Logging

The built-in --verbosity option automatically configures Serilog output levels:

# No logging output
dotnet run -- my-command --verbosity None

# Only errors and warnings  
dotnet run -- my-command --verbosity Error

# Full debug output
dotnet run -- my-command --verbosity Debug

Level mapping:

  • None → No logging output
  • Critical → Serilog Fatal
  • Error → Serilog Error
  • Warning → Serilog Warning
  • Information → Serilog Information
  • Debug → Serilog Debug
  • Trace → Serilog Verbose

Individual Extensions

You can use components separately instead of .WithDefaults():

await using var host = new CommandHost("My CLI App")
    .Parse(args)
    .WithConfig()    // Configuration only
    .WithSerilog()   // Logging only
    .Build();

WithConfig()

  • Loads appsettings.json files based on environment
  • Adds environment variable support
  • Registers IConfiguration, ProgramSetting, and IHostEnvironment services

WithSerilog()

  • Configures Serilog with console output
  • Maps verbosity levels appropriately
  • Uses the --verbosity option value

Dependencies

This package includes these integrations:

  • Albatross.Config (7.5.11): Configuration management and settings binding
  • Albatross.Logging (10.0.1): Serilog setup and configuration helpers
  • Microsoft.Extensions.Hosting (10.0.1): Host builder and environment abstractions
  • Microsoft.Extensions.DependencyInjection (10.0.1): Service container integration

When to Use

Use Albatross.CommandLine.Defaults when:

  • You want JSON configuration file support
  • You need structured logging with Serilog
  • You want verbosity control to work automatically
  • You prefer convention over configuration

Skip this package when:

  • You need custom logging providers (not Serilog)
  • You have complex configuration requirements
  • You want full control over service registration
  • Your CLI doesn't need configuration files

Target Framework

  • .NET Standard 2.1: Compatible with .NET 5+ and .NET Framework 4.8+
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
8.0.1-78.main 19 12/26/2025
8.0.1-72.main 24 12/24/2025
8.0.1-71.main 28 12/23/2025