Improve CLI experience for new projects
See original GitHub issueToday we have a lot of templates and if you’re starting on .NET is difficult to choose between them. Is also difficult to see what templates I can use… need to Google that.
If you’re using Visual Studio, everything is more clear, the templates are organized and we have a GUI for that. But I think we have a lot of developers working through CLI, using VS Code.
The idea here is to have a global .NET command that show some selectable options on terminal, as Angular does when you start a new App.
For example dotnet new
will show some questions to help me on creating my app.
dotnet new
- Web application (ASP.NET/Blazor)
- Mobile Application (MAUI)
- Console Application
...
We can have more options after selecting the first one, and goes on. You got the idea. Please, let me know if this make sense.
Further examples: a. templates instantiation in CLI
> dotnet new console –interactive
> Optional prameter --use-program-main – Whether to generate …
--use-program-main (leave empty for false): _
b. When failing to find command
> dotnet new comzole
> No templates found matching: 'comzole'.
> Did you want instantiate 'console' template by running 'dotnet new console'? Type [y]es to accept, [c]ancel to exit interactive mode, anything else to continue advices: _
> Do you want to search online for templates matching 'comzole'? Type [y]es to accept, [c]ancel to exit interactive mode, anything else to continue advices: _
c. During authoring a template
> dotnet new author --interactive
> Do you want to create a new template or from existing item/project? [N]ew, Existing [I]tem, Existing [P]roject: _
> Type the path to the project you want to turn into template: _
> Do you want to exclude common excludable items (build outputs, …, more info: github.com/dotnet/templating/doc/authoring/excludable-items): [y]es, [n]o: _
> Do you want to add some existing item templates to your project template?
> …
During search and list (again – possibly default with opt out):
> dotnet new search console
Searching for the templates...
Matches from template source: NuGet.org
…
You already a template installed exactly matching name 'console' and 3 additional approximate matches.
Do you want to:
(a) instantiate the local template by running 'dotnet new console'?
(b) list the other matching local templates by running 'dotnet new list console'?
(c) install the best online match by running 'dotnet new install Take.Blip.Client.Templates'?
(d) exit the interactive mode
Type your option: _
Audience: dotnet CLI users
Justification
- interactive mode is an easier experience for new users as well as some advanced users. The dotnet CLI command tree is very vast and it’s easy to the naming. Especially in
dotnet new
where the tree becomes bigger with each template installed. - it also brings an educational aspect on how to use the commands correctly by creating the command step-by-step or suggesting CTAs on errors (besides
--help
option)
Technical details
- consider as
System.CommandLine
middleware
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:9 (6 by maintainers)
Top GitHub Comments
We merged this issue with https://github.com/dotnet/templating/issues/6024. Please follow up there, sorry for inconvenience.
Love it! I’ve wanted this since we first started this project.