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

dotnet new command should work with the Name provided without the need to specify the name option (-n) #4468

Closed
egvijayanand opened this issue Feb 7, 2022 · 4 comments
Labels
feature The issue defines new feature.

Comments

@egvijayanand
Copy link
Contributor

Is your feature request related to a problem? Please describe.

dotnet new command should work with the Name provided without the need to specify its parameter name option (-n).

This is especially useful when working with item templates (where specifying the parameter name -n is overhead).

I hope readability also improves a lot.

Describe the solution you'd like

dotnet new razorcomponent MyComponent

Note: there is no need to specify the parameter name -n and the first specified parameter is handled as its name.

Additional context

Add any other context or screenshots about the feature request here.

@egvijayanand
Copy link
Contributor Author

Ideally, this should work this way for both project and items templates.

dotnet new maui MyApp
dotnet new maui-page LoginPage

The first value that follows the template shortName to be implicitly treated as Name, without having to mention its key -n|--name. Saves lots of keystrokes and is easy to understand.

Can this be included in the .NET 7 release scope?

@baronfel
Copy link
Member

This could be considered, but may be an ambiguous grammar. @vlada-shubina do we pass non-option tokens to templates in any way currently?

@vlada-shubina vlada-shubina transferred this issue from dotnet/sdk Mar 10, 2022
@vlada-shubina vlada-shubina added the feature The issue defines new feature. label Mar 10, 2022
@vlada-shubina
Copy link
Member

moved to dotnet/templating. This idea is not new, especially for item templates, it was hardly possible to implement it with old parser.

We don't pass non-option tokens to templates at the moment, it should be possible to do it but imo it makes already complex dotnet new syntax even more complex.

@vlada-shubina
Copy link
Member

Found same issue here: #3009. Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature The issue defines new feature.
Projects
None yet
Development

No branches or pull requests

3 participants