Ploch.CommandLine.Spectre.FluentValidation
1.0.51
dotnet add package Ploch.CommandLine.Spectre.FluentValidation --version 1.0.51
NuGet\Install-Package Ploch.CommandLine.Spectre.FluentValidation -Version 1.0.51
<PackageReference Include="Ploch.CommandLine.Spectre.FluentValidation" Version="1.0.51" />
<PackageVersion Include="Ploch.CommandLine.Spectre.FluentValidation" Version="1.0.51" />
<PackageReference Include="Ploch.CommandLine.Spectre.FluentValidation" />
paket add Ploch.CommandLine.Spectre.FluentValidation --version 1.0.51
#r "nuget: Ploch.CommandLine.Spectre.FluentValidation, 1.0.51"
#:package Ploch.CommandLine.Spectre.FluentValidation@1.0.51
#addin nuget:?package=Ploch.CommandLine.Spectre.FluentValidation&version=1.0.51
#tool nuget:?package=Ploch.CommandLine.Spectre.FluentValidation&version=1.0.51
Ploch.CommandLine.Spectre.FluentValidation
FluentValidation integration for Ploch.CommandLine.Spectre: command settings are validated by your FluentValidation validators before the command runs, and a failed validation is reported to the user instead of executing the command.
Installation
dotnet add package Ploch.CommandLine.Spectre.FluentValidation
Example
using FluentValidation;
using Ploch.CommandLine.Spectre;
using Ploch.CommandLine.Spectre.FluentValidation;
using Spectre.Console.Cli;
using var appBuilder = AppBuilder.Create(args)
.ConfigureServices((_, services) =>
services.AddCommandLineSettingsFluentValidation(
assemblies => assemblies.AddAssembly(typeof(GreetSettingsValidator).Assembly)));
// Register your commands with appBuilder.ConfigureCommandApp(...) and run them as usual.
public class GreetSettings : CommandSettings
{
[CommandOption("-n|--name")]
public string Name { get; set; } = string.Empty;
}
public class GreetSettingsValidator : AbstractValidator<GreetSettings>
{
public GreetSettingsValidator() => RuleFor(settings => settings.Name).NotEmpty();
}
Every public AbstractValidator<TSettings> in the scanned assemblies is picked up; commands derived
from AppCommand<TSettings> or AsyncAppCommand<TSettings> validate their settings automatically.
Internal validators are not scanned, so a settings type whose only validator is internal falls back to
CommandSettings.Validate().
Documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- Ploch.CommandLine.Spectre (>= 1.0.51)
- Ploch.Common (>= 4.0.47)
- Ploch.Common.DependencyInjection (>= 4.0.47)
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.51 | 75 | 10/30/2026 |