1 write to Templates
Microsoft.TemplateEngine.Cli (1)
TemplateGroup.cs (1)
48
Templates
= templates.ToList();
90 references to Templates
Microsoft.TemplateEngine.Cli (26)
Commands\create\InstantiateCommand.cs (2)
90
foreach (IGrouping<int, CliTemplateInfo> templateGrouping in templateGroup.
Templates
.GroupBy(g => g.Precedence).OrderByDescending(g => g.Key))
149
.DefineColumn(t => t.GroupIdentity ?? t.
Templates
[0].Identity, out object? identityColumn, LocalizableStrings.ColumnNameIdentity, showAlways: true)
Commands\create\InstantiateCommand.Help.cs (1)
345
foreach (IGrouping<int, CliTemplateInfo> templateGrouping in templateGroup.
Templates
.GroupBy(g => g.Precedence).OrderByDescending(g => g.Key))
Commands\create\InstantiateCommand.NoMatchHandling.cs (1)
64
foreach (CliTemplateInfo template in templateGroup.
Templates
)
Commands\create\InstantiateCommand.TabCompletion.cs (3)
141
if (templateGroup.
Templates
.SelectMany(t => t.Constraints).Any())
166
return templateGroup.
Templates
;
178
if (group.
Templates
.All(t => t.Constraints.Any()))
Commands\Extensions.cs (1)
55
await constraintManager.EvaluateConstraintsAsync(templateGroup.
Templates
, cancellationToken).ConfigureAwait(false);
TabularOutput\TemplateGroupDisplay.cs (5)
208
ITemplateInfo highestPrecedenceTemplate = templateGroup.
Templates
.OrderByDescending(x => x.Precedence).First();
213
Languages = GetLanguagesToDisplay(templateGroup.
Templates
, language, defaultLanguage, environment),
214
Classifications = GetClassificationsToDisplay(templateGroup.
Templates
, environment),
215
Author = GetAuthorsToDisplay(templateGroup.
Templates
, environment),
216
Type = GetTypesToDisplay(templateGroup.
Templates
, environment),
TemplateGroup.cs (11)
65
foreach (ITemplateInfo template in
Templates
.OrderByDescending(t => t.Precedence))
81
foreach (ITemplateInfo template in
Templates
)
97
foreach (ITemplateInfo template in
Templates
)
113
foreach (ITemplateInfo template in
Templates
)
159
foreach (ITemplateInfo template in
Templates
)
178
internal bool HasSingleTemplate =>
Templates
.Count == 1;
217
var templatePackages = await Task.WhenAll(
Templates
.Select(t => templatePackageManager.GetTemplatePackageAsync(t, cancellationToken))).ConfigureAwait(false);
223
if (!
Templates
.Any())
225
throw new Exception($"{nameof(
Templates
)} cannot be empty collection");
228
int highestPrecedence =
Templates
.Max(t => t.Precedence);
229
return
Templates
.Where(t => t.Precedence == highestPrecedence);
TemplateResolution\ListTemplateResolver.cs (1)
47
templateFilters = templateFilters.Concat(WellKnownSearchFilters.ConstraintFilters(await _constraintManager.GetConstraintsAsync(templateGroups.SelectMany(tg => tg.
Templates
).Cast<ITemplateInfo>(), cancellationToken).ConfigureAwait(false)));
TemplateResolution\TemplateGroupMatchInfo.cs (1)
218
IReadOnlyCollection<ITemplateMatchInfo> templateMatchDispositions = TemplateListFilter.GetTemplateMatchInfo(group.
Templates
, x => true, templateInfoFilters.ToArray());
Microsoft.TemplateEngine.Cli.UnitTests (64)
ParserTests\HelpTests.cs (18)
106
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
129
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
152
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
175
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
199
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
225
TemplateCommand templateCommand1 = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
[0]);
226
TemplateCommand templateCommand2 = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
[1]);
250
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
278
TemplateCommand templateCommand1 = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
[0]);
279
TemplateCommand templateCommand2 = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
[1]);
303
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
327
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
354
InstantiateCommand.ShowHintForOtherTemplates(templateGroup, templateGroup.
Templates
[0], args, sw);
373
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
397
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
439
TemplateCommand templateCommand1 = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
[0]);
440
TemplateCommand templateCommand2 = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
[1]);
464
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
ParserTests\InstantiateTests.cs (9)
257
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
323
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
366
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
410
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
481
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
526
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
550
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
583
TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
747
template: templateGroup.
Templates
.Single());
ParserTests\InstantiateTests.Subcommand.cs (5)
85
TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
148
TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
183
TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
226
TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
260
TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
ParserTests\TemplateCommandTests.cs (2)
52
_ = new TemplateCommand(myCommand, settings, packageManager, templateGroup, templateGroup.
Templates
.Single());
57
Assert.Equal(templateGroup.
Templates
.Single(), e.Template);
TemplateResolutionTests\ListTemplateResolverTests.cs (30)
35
Assert.Equal("console2", matchResult.UnambiguousTemplateGroup?.
Templates
.Single().ShortNameList.Single());
36
Assert.Equal("Console.App2", matchResult.UnambiguousTemplateGroup?.
Templates
.Single().Identity);
37
Assert.Single(matchResult.UnambiguousTemplateGroup?.
Templates
!);
58
Assert.NotNull(matchResult.TemplateGroupsWithMatchingTemplateInfo.SelectMany(group => group.
Templates
).Single(t => t.Identity == "Console.App"));
59
Assert.NotNull(matchResult.TemplateGroupsWithMatchingTemplateInfo.SelectMany(group => group.
Templates
).Single(t => t.Identity == "Console.App2"));
80
Assert.Equal(3, matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
.Count);
82
Assert.Equal(3, matchResult.UnambiguousTemplateGroup?.
Templates
.Count);
105
Assert.Equal(5, matchResult.TemplateGroupsWithMatchingTemplateInfo.SelectMany(group => group.
Templates
).Count());
127
Assert.Equal(2, matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
.Count);
128
Assert.NotNull(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
.Single(t => t.Identity == "Console.App.L1"));
129
Assert.NotNull(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
.Single(t => t.Identity == "Console.App.L2"));
149
Assert.Equal(2, matchResult.TemplateGroupsWithMatchingTemplateInfo?.Single().
Templates
.Count);
150
Assert.Equal(2, matchResult.UnambiguousTemplateGroup?.
Templates
.Count);
173
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
200
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
227
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
254
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
309
Assert.Single(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
);
341
Assert.Single(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
);
345
Assert.Equal("console1", matchResult.UnambiguousTemplateGroup?.
Templates
.Single().ShortNameList.Single());
346
Assert.Equal("Console.App.T1", matchResult.UnambiguousTemplateGroup?.
Templates
.Single().Identity);
374
Assert.Single(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
);
378
Assert.Equal("console", matchResult.UnambiguousTemplateGroup?.
Templates
.Single().ShortNameList.Single());
379
Assert.Equal("Console.App.T1", matchResult.UnambiguousTemplateGroup?.
Templates
.Single().Identity);
404
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
438
Assert.Single(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
);
447
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
490
Assert.Single(matchResult.TemplateGroupsWithMatchingTemplateInfo.Single().
Templates
);
499
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);
528
Assert.Single(matchResult.TemplateGroups.Single().
Templates
);