Kiwify.Kiwi.CLI.Configuration 1.0.0

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

Kiwify.Kiwi.CLI.Configuration

Bridges CLI-parsed command values into the standard Microsoft.Extensions.Configuration pipeline. Lets command-line options flow into IConfiguration alongside JSON files, environment variables, and other providers.

Target: net6.0 Dependencies: Kiwify.Kiwi.CLI, Microsoft.Extensions.Configuration, Microsoft.Extensions.Configuration.Abstractions


How it works

After app.Execute(args) runs, call GetExecutedCommand<T>() to retrieve the populated command object, then pass it to AddKiwiCommandModel. Only properties that were explicitly set on the command line are included - defaults that were never supplied are omitted, so they don't shadow values from other providers.


Usage

using Kiwify.Kiwi.CLI.Configuration;
using Microsoft.Extensions.Configuration;

app.Execute(args);

var cmd = app.GetExecutedCommand<SetupOptions>();
if (cmd is not null)
{
    IConfigurationBuilder builder = new ConfigurationBuilder()
        .AddJsonFile("appsettings.json", optional: true)
        .AddEnvironmentVariables()
        .AddKiwiCommandModel(cmd, sectionPrefix: "app");  // CLI wins over earlier providers

    IConfigurationRoot config = builder.Build();

    // Values are available via standard IConfiguration API
    var host = config["app:Host"];
    var port = config["app:Port"];
}

Without a section prefix

builder.AddKiwiCommandModel(cmd);
// Keys are flat: "Host", "Port", "Workers"

Merging into an existing IConfigurationRoot

IConfigurationRoot existing = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();

IConfigurationRoot merged = existing
    .AddKiwiCommandModelToExistingConfiguration(cmd, sectionPrefix: "app");

Key mapping

Property type Key format
Primitive (string, int, bool) prefix:PropertyName
Collection (string[], List<T>) prefix:PropertyName:0, :1, :2
Dictionary prefix:PropertyName:key1, :key2
Nested object prefix:PropertyName:NestedProp

Property names respect [PropertyName] and [JsonPropertyName] attributes.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
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
1.0.0 97 5/28/2026