-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use System.CommandLine to parse cmdline args and allow provider to offer cmds #273
Conversation
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.
There is certainly a lot going on here, but I appreciate that the tests get a bit simpler.
I hope this makes things easier as you extend into other features.
public interface ICommandProvider | ||
{ | ||
/// <summary> | ||
/// Configure a custom provider command. | ||
/// </summary> | ||
/// <param name="rootCommand">Root provider command.</param> | ||
void ConfigureCommand(Command rootCommand); | ||
} | ||
|
||
internal class ProviderCommand : Command |
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.
I'm a little confused as to why these are in the same file. They are not using each other in any visible way.
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.
That's because I'm an idiot 😜
I changed the extension point design here a few times, but this doesn't "feel" right. I've moved to a factory style now where an ICommandProvider
implementing host provider returns a new ProviderCommand
instance from the CreateCommand()
method.
Replace our basic custom command-line handling code with the System.CommandLine library which provides simpler and easier handling.
Add the ability for host providers to register themselves as offering custom commands, under the provider ID name. For example a provider with the ID 'foo' would be able to expose commands under the `git-credential-manager-core foo <..>` command.
Yes, when we only had the
That's the plan! |
Replace our basic custom command-line handling code with the System.CommandLine library which provides simpler and easier handling.
Add the ability for host providers to register themselves as offering custom commands, under the provider ID name.
For example a provider with the ID 'foo' would be able to expose commands under the
git-credential-manager-core foo <..>
command.