@@ -24,12 +24,12 @@ internal TemplateListCoordinator(
24
24
IEngineEnvironmentSettings engineEnvironmentSettings ,
25
25
TemplatePackageManager templatePackageManager ,
26
26
IHostSpecificDataLoader hostSpecificDataLoader )
27
-
28
27
{
29
28
_engineEnvironmentSettings = engineEnvironmentSettings ?? throw new ArgumentNullException ( nameof ( engineEnvironmentSettings ) ) ;
30
29
_templatePackageManager = templatePackageManager ?? throw new ArgumentNullException ( nameof ( templatePackageManager ) ) ;
31
30
_hostSpecificDataLoader = hostSpecificDataLoader ?? throw new ArgumentNullException ( nameof ( hostSpecificDataLoader ) ) ;
32
31
_defaultLanguage = engineEnvironmentSettings . GetDefaultLanguage ( ) ;
32
+ using var constraintManagerActivity = Activities . Source . StartActivity ( "create-constraints" ) ;
33
33
_constraintManager = new TemplateConstraintManager ( _engineEnvironmentSettings ) ;
34
34
}
35
35
@@ -48,7 +48,6 @@ internal async Task<NewCommandStatus> DisplayTemplateGroupListAsync(
48
48
ListTemplateResolver resolver = new ( _constraintManager , _templatePackageManager , _hostSpecificDataLoader ) ;
49
49
TemplateResolutionResult resolutionResult = await resolver . ResolveTemplatesAsync ( args , _defaultLanguage , cancellationToken ) . ConfigureAwait ( false ) ;
50
50
51
- //IReadOnlyDictionary<string, string?>? appliedParameterMatches = resolutionResult.GetAllMatchedParametersList();
52
51
if ( resolutionResult . TemplateGroupsWithMatchingTemplateInfoAndParameters . Any ( ) )
53
52
{
54
53
Reporter . Output . WriteLine ( LocalizableStrings . TemplatesFoundMatchingInputParameters , GetInputParametersString ( args ) ) ;
@@ -66,10 +65,10 @@ internal async Task<NewCommandStatus> DisplayTemplateGroupListAsync(
66
65
}
67
66
else
68
67
{
69
- //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.
70
69
if ( args . ListNameCriteria == null && ! args . AppliedFilters . Any ( ) )
71
70
{
72
- //No templates installed.
71
+ // No templates installed.
73
72
Reporter . Output . WriteLine ( LocalizableStrings . NoTemplatesFound ) ;
74
73
Reporter . Output . WriteLine ( ) ;
75
74
// To search for the templates on NuGet.org, run:
@@ -83,7 +82,7 @@ internal async Task<NewCommandStatus> DisplayTemplateGroupListAsync(
83
82
return NewCommandStatus . Success ;
84
83
}
85
84
86
- // at least one criteria was specified.
85
+ // At least one criteria was specified.
87
86
// No templates found matching the following input parameter(s): {0}.
88
87
Reporter . Error . WriteLine (
89
88
string . Format (
@@ -195,33 +194,30 @@ internal async Task<NewCommandStatus> DisplayCommandDescriptionAsync(
195
194
return NewCommandStatus . Success ;
196
195
}
197
196
198
- private static string GetInputParametersString ( ListCommandArgs args /*, IReadOnlyDictionary<string, string?>? templateParameters = null*/ )
197
+ private static string GetInputParametersString ( ListCommandArgs args )
199
198
{
200
199
string separator = ", " ;
201
200
IEnumerable < string > appliedFilters = args . AppliedFilters
202
201
. Select ( filter => $ "{ args . GetFilterToken ( filter ) } ='{ args . GetFilterValue ( filter ) } '") ;
203
202
204
- //IEnumerable<string> appliedTemplateParameters = templateParameters?
205
- // .Select(param => string.IsNullOrWhiteSpace(param.Value) ? param.Key : $"{param.Key}='{param.Value}'") ?? Array.Empty<string>();
206
-
207
203
StringBuilder inputParameters = new ( ) ;
208
204
string ? mainCriteria = args . ListNameCriteria ;
209
205
if ( ! string . IsNullOrWhiteSpace ( mainCriteria ) )
210
206
{
211
207
inputParameters . Append ( $ "'{ mainCriteria } '") ;
212
- if ( appliedFilters . Any ( ) /* || appliedTemplateParameters.Any()*/ )
208
+ if ( appliedFilters . Any ( ) )
213
209
{
214
210
inputParameters . Append ( separator ) ;
215
211
}
216
212
}
217
- if ( appliedFilters /*.Concat(appliedTemplateParameters)*/ . Any ( ) )
213
+ if ( appliedFilters . Any ( ) )
218
214
{
219
- inputParameters . Append ( string . Join ( separator , appliedFilters /*.Concat(appliedTemplateParameters)*/ ) ) ;
215
+ inputParameters . Append ( string . Join ( separator , appliedFilters ) ) ;
220
216
}
221
217
return inputParameters . ToString ( ) ;
222
218
}
223
219
224
- private static string GetPartialMatchReason ( TemplateResolutionResult templateResolutionResult , ListCommandArgs args /*, IReadOnlyDictionary<string, string?>? templateParameters = null*/ )
220
+ private static string GetPartialMatchReason ( TemplateResolutionResult templateResolutionResult , ListCommandArgs args )
225
221
{
226
222
string separator = ", " ;
227
223
@@ -230,15 +226,10 @@ private static string GetPartialMatchReason(TemplateResolutionResult templateRes
230
226
. Where ( filter => filter . MismatchCriteria ( templateResolutionResult ) )
231
227
. Select ( filter => $ "{ args . GetFilterToken ( filter ) } ='{ args . GetFilterValue ( filter ) } '") ;
232
228
233
- //IEnumerable<string> appliedTemplateParameters = templateParameters?
234
- // .Where(parameter =>
235
- // templateResolutionResult.IsParameterMismatchReason(parameter.Key))
236
- // .Select(param => string.IsNullOrWhiteSpace(param.Value) ? param.Key : $"{param.Key}='{param.Value}'") ?? Array.Empty<string>();
237
-
238
229
StringBuilder inputParameters = new ( ) ;
239
- if ( appliedFilters /*.Concat(appliedTemplateParameters)*/ . Any ( ) )
230
+ if ( appliedFilters . Any ( ) )
240
231
{
241
- inputParameters . Append ( string . Join ( separator , appliedFilters /*.Concat(appliedTemplateParameters)*/ ) ) ;
232
+ inputParameters . Append ( string . Join ( separator , appliedFilters ) ) ;
242
233
}
243
234
return inputParameters . ToString ( ) ;
244
235
}
0 commit comments