question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve CLI experience for new projects

See original GitHub issue

Today 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:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vlada-shubinacommented, May 18, 2023

We merged this issue with https://github.com/dotnet/templating/issues/6024. Please follow up there, sorry for inconvenience.

1reaction
sayedihashimicommented, Apr 18, 2022

Love it! I’ve wanted this since we first started this project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developer Experience with Command Line Interface(CLI) Tools
Embracing the new wave of CLI tools will give you great improvement in the amount of time you spend clicking around to make...
Read more >
Improving Developer Productivity by Building a CLI
Building a custom CLI that wraps common commands or even something more sophisticated like a build script can be a huge productivity booster...
Read more >
CLI tricks every developer should know
Learn some tips, tricks, and tools for mastering the command line from GitHub's own developers.
Read more >
Best Practices Building a CLI Tool for Your Service
Zapier support engineer Jacob Blakely advises that usability and discovery are paramount in a CLI application. That experience begins in the ...
Read more >
Command Line Interface Guidelines
An open-source guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found