From 2fa5aedfa5a90cc6164e989997d1f71b70e8ffed Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Sat, 9 Mar 2024 19:33:50 +0300 Subject: [PATCH] Remove help description from all non-help-related models --- .../ArgumentParserGenerator.Extract.cs | 13 ++++++------- src/ArgumentParsing.Generators/Models/OptionInfo.cs | 3 +-- .../Models/ParameterInfo.cs | 3 +-- .../Models/RemainingParametersInfo.cs | 3 +-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/ArgumentParsing.Generators/ArgumentParserGenerator.Extract.cs b/src/ArgumentParsing.Generators/ArgumentParserGenerator.Extract.cs index 2f0df1e..259b574 100644 --- a/src/ArgumentParsing.Generators/ArgumentParserGenerator.Extract.cs +++ b/src/ArgumentParsing.Generators/ArgumentParserGenerator.Extract.cs @@ -124,6 +124,7 @@ private static (OptionsInfo? OptionsInfo, OptionsHelpInfo? OptionsHelpInfo, Immu var seenLongNames = new HashSet(); var parameterMap = new Dictionary(); + var parameterHelpDescriptionsMap = new Dictionary(); var parametersProperties = new Dictionary(); var firstIndexWithNoError = new Dictionary(); @@ -328,8 +329,7 @@ private static (OptionsInfo? OptionsInfo, OptionsHelpInfo? OptionsHelpInfo, Immu parseStrategy, isRequired, nullableUnderlyingType, - sequenceType, - helpDescription)); + sequenceType)); optionsHelpBuilder.Add(new( shortName, @@ -396,10 +396,10 @@ private static (OptionsInfo? OptionsInfo, OptionsHelpInfo? OptionsHelpInfo, Immu propertyType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), parseStrategy, isRequired, - nullableUnderlyingType, - helpDescription); + nullableUnderlyingType); parameterMap.Add(parameterIndex, parameterInfo); + parameterHelpDescriptionsMap.Add(parameterInfo, helpDescription); parametersProperties.Add(parameterInfo, property); } } @@ -444,8 +444,7 @@ private static (OptionsInfo? OptionsInfo, OptionsHelpInfo? OptionsHelpInfo, Immu propertyName, sequenceUnderlyingType!, parseStrategy, - sequenceType, - helpDescription); + sequenceType); remainingParametersHelpInfo = new(helpDescription); } @@ -475,7 +474,7 @@ private static (OptionsInfo? OptionsInfo, OptionsHelpInfo? OptionsHelpInfo, Immu var parameterInfo = pair.Value; parametersBuilder.Add(parameterInfo); - parametersHelpBuilder.Add(new(parameterInfo.Name, parameterInfo.IsRequired, parameterInfo.HelpDescription)); + parametersHelpBuilder.Add(new(parameterInfo.Name, parameterInfo.IsRequired, parameterHelpDescriptionsMap[parameterInfo])); lastSeenIndex = index; } diff --git a/src/ArgumentParsing.Generators/Models/OptionInfo.cs b/src/ArgumentParsing.Generators/Models/OptionInfo.cs index f0e7600..f7ff98a 100644 --- a/src/ArgumentParsing.Generators/Models/OptionInfo.cs +++ b/src/ArgumentParsing.Generators/Models/OptionInfo.cs @@ -8,5 +8,4 @@ internal sealed record OptionInfo( ParseStrategy ParseStrategy, bool IsRequired, string? NullableUnderlyingType, - SequenceType SequenceType, - string? HelpDescription); + SequenceType SequenceType); diff --git a/src/ArgumentParsing.Generators/Models/ParameterInfo.cs b/src/ArgumentParsing.Generators/Models/ParameterInfo.cs index 1682a53..acf339e 100644 --- a/src/ArgumentParsing.Generators/Models/ParameterInfo.cs +++ b/src/ArgumentParsing.Generators/Models/ParameterInfo.cs @@ -6,5 +6,4 @@ internal sealed record ParameterInfo( string Type, ParseStrategy ParseStrategy, bool IsRequired, - string? NullableUnderlyingType, - string? HelpDescription); + string? NullableUnderlyingType); diff --git a/src/ArgumentParsing.Generators/Models/RemainingParametersInfo.cs b/src/ArgumentParsing.Generators/Models/RemainingParametersInfo.cs index f38c6cf..5a1d5e2 100644 --- a/src/ArgumentParsing.Generators/Models/RemainingParametersInfo.cs +++ b/src/ArgumentParsing.Generators/Models/RemainingParametersInfo.cs @@ -4,5 +4,4 @@ internal sealed record RemainingParametersInfo( string PropertyName, string Type, ParseStrategy ParseStrategy, - SequenceType SequenceType, - string? HelpDescription); + SequenceType SequenceType);