@@ -24,13 +24,12 @@ internal TemplateListCoordinator(
2424 IEngineEnvironmentSettings engineEnvironmentSettings ,
2525 TemplatePackageManager templatePackageManager ,
2626 IHostSpecificDataLoader hostSpecificDataLoader )
27-
2827 {
2928 _engineEnvironmentSettings = engineEnvironmentSettings ?? throw new ArgumentNullException ( nameof ( engineEnvironmentSettings ) ) ;
3029 _templatePackageManager = templatePackageManager ?? throw new ArgumentNullException ( nameof ( templatePackageManager ) ) ;
3130 _hostSpecificDataLoader = hostSpecificDataLoader ?? throw new ArgumentNullException ( nameof ( hostSpecificDataLoader ) ) ;
3231 _defaultLanguage = engineEnvironmentSettings . GetDefaultLanguage ( ) ;
33- using var constraintManagerActivity = Activities . s_source . StartActivity ( "create-constraints" ) ;
32+ using var constraintManagerActivity = Activities . Source . StartActivity ( "create-constraints" ) ;
3433 _constraintManager = new TemplateConstraintManager ( _engineEnvironmentSettings ) ;
3534 }
3635
@@ -49,7 +48,6 @@ internal async Task<NewCommandStatus> DisplayTemplateGroupListAsync(
4948 ListTemplateResolver resolver = new ( _constraintManager , _templatePackageManager , _hostSpecificDataLoader ) ;
5049 TemplateResolutionResult resolutionResult = await resolver . ResolveTemplatesAsync ( args , _defaultLanguage , cancellationToken ) . ConfigureAwait ( false ) ;
5150
52- //IReadOnlyDictionary<string, string?>? appliedParameterMatches = resolutionResult.GetAllMatchedParametersList();
5351 if ( resolutionResult . TemplateGroupsWithMatchingTemplateInfoAndParameters . Any ( ) )
5452 {
5553 Reporter . Output . WriteLine ( LocalizableStrings . TemplatesFoundMatchingInputParameters , GetInputParametersString ( args ) ) ;
@@ -67,10 +65,10 @@ internal async Task<NewCommandStatus> DisplayTemplateGroupListAsync(
6765 }
6866 else
6967 {
70- //if there is no criteria and filters it means that dotnet new list was run but there is no templates installed.
68+ // If there is no criteria and filters, it means that dotnet new list was run but there are no templates installed.
7169 if ( args . ListNameCriteria == null && ! args . AppliedFilters . Any ( ) )
7270 {
73- //No templates installed.
71+ // No templates installed.
7472 Reporter . Output . WriteLine ( LocalizableStrings . NoTemplatesFound ) ;
7573 Reporter . Output . WriteLine ( ) ;
7674 // To search for the templates on NuGet.org, run:
@@ -84,7 +82,7 @@ internal async Task<NewCommandStatus> DisplayTemplateGroupListAsync(
8482 return NewCommandStatus . Success ;
8583 }
8684
87- // at least one criteria was specified.
85+ // At least one criteria was specified.
8886 // No templates found matching the following input parameter(s): {0}.
8987 Reporter . Error . WriteLine (
9088 string . Format (
@@ -196,33 +194,30 @@ internal async Task<NewCommandStatus> DisplayCommandDescriptionAsync(
196194 return NewCommandStatus . Success ;
197195 }
198196
199- private static string GetInputParametersString ( ListCommandArgs args /*, IReadOnlyDictionary<string, string?>? templateParameters = null*/ )
197+ private static string GetInputParametersString ( ListCommandArgs args )
200198 {
201199 string separator = ", " ;
202200 IEnumerable < string > appliedFilters = args . AppliedFilters
203201 . Select ( filter => $ "{ args . GetFilterToken ( filter ) } ='{ args . GetFilterValue ( filter ) } '") ;
204202
205- //IEnumerable<string> appliedTemplateParameters = templateParameters?
206- // .Select(param => string.IsNullOrWhiteSpace(param.Value) ? param.Key : $"{param.Key}='{param.Value}'") ?? Array.Empty<string>();
207-
208203 StringBuilder inputParameters = new ( ) ;
209204 string ? mainCriteria = args . ListNameCriteria ;
210205 if ( ! string . IsNullOrWhiteSpace ( mainCriteria ) )
211206 {
212207 inputParameters . Append ( $ "'{ mainCriteria } '") ;
213- if ( appliedFilters . Any ( ) /* || appliedTemplateParameters.Any()*/ )
208+ if ( appliedFilters . Any ( ) )
214209 {
215210 inputParameters . Append ( separator ) ;
216211 }
217212 }
218- if ( appliedFilters /*.Concat(appliedTemplateParameters)*/ . Any ( ) )
213+ if ( appliedFilters . Any ( ) )
219214 {
220- inputParameters . Append ( string . Join ( separator , appliedFilters /*.Concat(appliedTemplateParameters)*/ ) ) ;
215+ inputParameters . Append ( string . Join ( separator , appliedFilters ) ) ;
221216 }
222217 return inputParameters . ToString ( ) ;
223218 }
224219
225- private static string GetPartialMatchReason ( TemplateResolutionResult templateResolutionResult , ListCommandArgs args /*, IReadOnlyDictionary<string, string?>? templateParameters = null*/ )
220+ private static string GetPartialMatchReason ( TemplateResolutionResult templateResolutionResult , ListCommandArgs args )
226221 {
227222 string separator = ", " ;
228223
@@ -231,15 +226,10 @@ private static string GetPartialMatchReason(TemplateResolutionResult templateRes
231226 . Where ( filter => filter . MismatchCriteria ( templateResolutionResult ) )
232227 . Select ( filter => $ "{ args . GetFilterToken ( filter ) } ='{ args . GetFilterValue ( filter ) } '") ;
233228
234- //IEnumerable<string> appliedTemplateParameters = templateParameters?
235- // .Where(parameter =>
236- // templateResolutionResult.IsParameterMismatchReason(parameter.Key))
237- // .Select(param => string.IsNullOrWhiteSpace(param.Value) ? param.Key : $"{param.Key}='{param.Value}'") ?? Array.Empty<string>();
238-
239229 StringBuilder inputParameters = new ( ) ;
240- if ( appliedFilters /*.Concat(appliedTemplateParameters)*/ . Any ( ) )
230+ if ( appliedFilters . Any ( ) )
241231 {
242- inputParameters . Append ( string . Join ( separator , appliedFilters /*.Concat(appliedTemplateParameters)*/ ) ) ;
232+ inputParameters . Append ( string . Join ( separator , appliedFilters ) ) ;
243233 }
244234 return inputParameters . ToString ( ) ;
245235 }
0 commit comments