Fix typo in PairDeconstructor class name

PairDeconstuctor → PairDeconstructor (was missing an 'r')

Keeping `PairDeconstuctor` and marking it as obsolete since it's a public type.
This commit is contained in:
Cédric Luthi 2021-11-10 14:16:58 +01:00 committed by Patrik Svensson
parent 48df9cf68b
commit 19eb273813
3 changed files with 15 additions and 4 deletions

View File

@ -28,7 +28,7 @@ namespace Spectre.Console.Cli
Type parameterType, ParameterKind parameterKind, PropertyInfo property, Type parameterType, ParameterKind parameterKind, PropertyInfo property,
string? description, TypeConverterAttribute? converter, string? description, TypeConverterAttribute? converter,
DefaultValueAttribute? defaultValue, DefaultValueAttribute? defaultValue,
PairDeconstructorAttribute? deconstuctor, PairDeconstructorAttribute? deconstructor,
ParameterValueProviderAttribute? valueProvider, ParameterValueProviderAttribute? valueProvider,
IEnumerable<ParameterValidationAttribute> validators, bool required) IEnumerable<ParameterValidationAttribute> validators, bool required)
{ {
@ -39,7 +39,7 @@ namespace Spectre.Console.Cli
Description = description; Description = description;
Converter = converter; Converter = converter;
DefaultValue = defaultValue; DefaultValue = defaultValue;
PairDeconstructor = deconstuctor; PairDeconstructor = deconstructor;
ValueProvider = valueProvider; ValueProvider = valueProvider;
Validators = new List<ParameterValidationAttribute>(validators ?? Array.Empty<ParameterValidationAttribute>()); Validators = new List<ParameterValidationAttribute>(validators ?? Array.Empty<ParameterValidationAttribute>());
Required = required; Required = required;

View File

@ -7,7 +7,7 @@ namespace Spectre.Console.Cli
/// </summary> /// </summary>
/// <typeparam name="TKey">The key type.</typeparam> /// <typeparam name="TKey">The key type.</typeparam>
/// <typeparam name="TValue">The value type.</typeparam> /// <typeparam name="TValue">The value type.</typeparam>
public abstract class PairDeconstuctor<TKey, TValue> : IPairDeconstructor public abstract class PairDeconstructor<TKey, TValue> : IPairDeconstructor
{ {
/// <summary> /// <summary>
/// Deconstructs the provided <see cref="string"/> into a pair. /// Deconstructs the provided <see cref="string"/> into a pair.
@ -27,4 +27,15 @@ namespace Spectre.Console.Cli
return Deconstruct(value); return Deconstruct(value);
} }
} }
/// <summary>
/// Base class for a pair deconstructor.
/// </summary>
/// <typeparam name="TKey">The key type.</typeparam>
/// <typeparam name="TValue">The value type.</typeparam>
/// <remarks>This class is misspelled, use <see cref="PairDeconstructor{TKey,TValue}"/> instead.</remarks>
[Obsolete("Use PairDeconstructor instead")]
public abstract class PairDeconstuctor<TKey, TValue> : PairDeconstructor<TKey, TValue>
{
}
} }

View File

@ -56,7 +56,7 @@ namespace Spectre.Console.Tests.Unit.Cli
public IReadOnlyDictionary<string, string> Values { get; set; } public IReadOnlyDictionary<string, string> Values { get; set; }
} }
public sealed class StringIntDeconstructor : PairDeconstuctor<string, string> public sealed class StringIntDeconstructor : PairDeconstructor<string, string>
{ {
protected override (string Key, string Value) Deconstruct(string value) protected override (string Key, string Value) Deconstruct(string value)
{ {