-
Notifications
You must be signed in to change notification settings - Fork 368
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
[system-command-line] replaced host and telemetry logger parameters to NewCommand
with delegates
#4254
[system-command-line] replaced host and telemetry logger parameters to NewCommand
with delegates
#4254
Conversation
That looks pretty straightforward to consume. It's essentially taking the same logic that's inside the Binder I made in my PR for the new Command, so it should be easy to extract that and be good to go 👍 |
106e3e9
to
469f4ef
Compare
|
||
commandResult | ||
.Should() | ||
.Fail() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR: why do we fail when we try to list 0 templates? Sounds like list command executed successfully here.
src/Microsoft.TemplateEngine.Cli/Commands/alias/AliasCommand.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, after inspecting calls to CreateTelemetryLogger and CreateEnvironmentSettings looks like we dont need to do any caching...
469f4ef
to
caa98cc
Compare
caa98cc
to
3771a89
Compare
SDK (and also dotnet new3) needs to read some of the args to build the host.
In dotnet new3 this was solved via "pre-parsing" which was not ideal solution. Doing similar thing in SDK is not a way to go.
I have replaced
host
andtelemetryLogger
parameters with `Func<ParseResult, T> delegates to be able to create those once parsing is done. This way SDK may define additional options, add them to command and use them when creating hosts in this delegates.Check the adaptation of dotnet new3 code to see how it works.
This revealed a problem when moving from dotnet new to instantiate command and manually adding global options to each
BaseCommand
.--debug:
options were moved asGlobalOption
on inNewCommand
now. Also added tests for--debug:
options.fixes #3812
fixes #3053