[system-command-line] replaced host and telemetry logger parameters to NewCommand with delegates - #4254
Merged
vlada-shubina merged 3 commits intoJan 14, 2022
Conversation
Member
|
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 👍 |
vlada-shubina
force-pushed
the
binding
branch
from
January 13, 2022 09:35
106e3e9 to
469f4ef
Compare
vlada-shubina
marked this pull request as ready for review
January 13, 2022 09:40
This was
linked to
issues
Jan 13, 2022
bekir-ozturk
approved these changes
Jan 14, 2022
|
|
||
| commandResult | ||
| .Should() | ||
| .Fail() |
There was a problem hiding this comment.
Unrelated to this PR: why do we fail when we try to list 0 templates? Sounds like list command executed successfully here.
DavidKarlas
approved these changes
Jan 14, 2022
DavidKarlas
left a comment
There was a problem hiding this comment.
Cool, after inspecting calls to CreateTelemetryLogger and CreateEnvironmentSettings looks like we dont need to do any caching...
vlada-shubina
force-pushed
the
binding
branch
from
January 14, 2022 12:15
469f4ef to
caa98cc
Compare
vlada-shubina
force-pushed
the
binding
branch
from
January 14, 2022 13:47
caa98cc to
3771a89
Compare
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
hostandtelemetryLoggerparameters 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 asGlobalOptionon inNewCommandnow. Also added tests for--debug:options.fixes #3812
fixes #3053