Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): update prompt for installed template to present available options #436

Merged
merged 4 commits into from
May 17, 2022

Conversation

AgentEnder
Copy link
Member

Previously, we prompted with a link to MSDN and a free-text field. Now, we run dotnet new --list to generate the list of possible templates, filtering by the value provided by --template {v}. This results in a select instead of freetext, that is filtered by language and search term.

@nx-cloud
Copy link

nx-cloud bot commented May 12, 2022

@AgentEnder AgentEnder force-pushed the feat/list-installed-templates branch from 7f99264 to fafa234 Compare May 12, 2022 15:49
@AgentEnder AgentEnder requested a review from bcallaghan-et May 12, 2022 16:05
const available = client.listInstalledTemplates({ search, language });

if (available.length === 1) {
return available[0].shortNames[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be unexpected behavior for most users. A user who supplies no template option, but only has one installed template, will expect a list of templates to choose from (even though only one choice is available). A user who supplies a template option, but only has one installed template, will expect their specified template to be the one chosen, even though it's not installed. It's incredibly unlikely that a user only has one template (since many ship with .NET itself), but this is still unusual behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had removed this at one point, I do see the point behind it being unexpected behavior in the case where the user only has 1 template installed.

The trade off is that something like nx g lib --language C# --template class would present a dialog w/ 1 option (classlib) rather than just moving forward w/ classlib. I think that's acceptable, and its easy to remove the condition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that this check occurs after filtering the list, so I hadn't considered the user doing a search and having only one result. In that scenario, using the only search result without further prompting seems fine to me.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@AgentEnder AgentEnder merged commit 5a941ae into master May 17, 2022
@AgentEnder AgentEnder deleted the feat/list-installed-templates branch May 17, 2022 14:27
github-actions bot pushed a commit that referenced this pull request May 18, 2022
# [1.10.0](v1.9.12...v1.10.0) (2022-05-18)

### Features

* **core:** update prompt for installed template to present available options ([#436](#436)) ([5a941ae](5a941ae))

May 18, 2022, 2:13 PM
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants