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

isRequired symbol should throw an error rather than greedly eat the following symbol #8209

Open
nicolo-castro-hudl opened this issue Jul 10, 2024 · 0 comments

Comments

@nicolo-castro-hudl
Copy link

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

When defining a required symbol, if no value is provided during the call, and the symbol is followed by another symbol, the required symbol will consume the following one rather than throw an error.

Describe the solution you'd like.

If no parameter is explicitly provided for a required symbol an error shuld be thrown rather than consuming the following symbol.

Additional context

given the following template.json

"symbols": {
    "foo": {
      "description": "",
      "type": "parameter",
      "dataType": "string",
      "replaces": "foo",
      "isRequired": true
    },
    "bar": {
      "description": "",
      "type": "parameter",
      "dataType": "string",
      "replaces": "bar",
      "defaultValue": "bar"
    }
  }

when called like so:
dotnet new new-template --foo --bar -n TestProj
the result is
Template

namespace TestNamespace;

public static class MyClass
{
    public static string Foo { get; set; } = "foo";
    public static string Bar { get; set; } = "bar";
}

Actual

namespace TestNamespace;

public static class MyClass
{
    public static string Foo { get; set; } = "--bar";
    public static string Bar { get; set; } = "bar";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant