dotnet / dotnet/templating

Allow to pick up certain template group or certain template to be run in case of ambiguity

Open
#4,135 6 comments 2 reactions 1 assignee Claimed by @baronfel View on GitHub
area: CLI Priority:2 triage:transfer-to-sdk triaged
Dominant language
No language data
Stars
1.7k
Forks
399
Avg merge
3d 5h
Merged PRs (30d)
39

Description

At the moment 2 cases for ambiguity may happen during template instantiation:
- different template groups may have same short name
- different templates in one group may have same precedence and it is not possible to determine the one to be run

Those cases may be solved by uninstalling one of the packages in template groups are coming from different packages, however if they are coming from single one the situation cannot be resolved.

Suggesting the following options to resolve these conflicts:
- `--group` allows to specify group identity to run
- `--identity` allows to specify template identity to run

The error cases should be modified as following:
(ambiguous group)
`Unable to resolve the template, these templates matched your input:`
| Name | Short name | Group |
|---|---|---|
| Template 1 | short | Group.Identity1 |
| Template 2 | short | Group.Identity2 |

`To run specific template, specify its group using --group option.`
` dotnet new short --group Group.Identity1.`

(ambiguous template)
`Unable to resolve the template, these templates matched your input:`
| Name | Short name | Identity |
|---|---|---|
| Template 1 | short | Templ.Identity1 |
| Template 2 | short | Templ.Identity2 |

`This may happen due to authoring error or ambiguous parameter set`.
`To run specific template, specify the identity using --identity option.`
` dotnet new short --identity Templ.Identity1 `

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.