JasperFx / oakton

Parsing and Utilities for Command Line Tools in .Net
http://jasperfx.github.io/oakton
Apache License 2.0
308 stars 41 forks source link

Fix DI scope disposal and support for overridding the default command #95

Closed tgardner closed 2 months ago

tgardner commented 2 months ago

refactor(DependencyInjectionCommandCreator): use ActivatorUtilities for command creation

refactor(HostedCommandExtensions): simplify Oakton registration and command execution

feat(HostedCommandExtensions): add OaktonOptions for configuration

refactor(HostedCommandExtensions): remove HostedCommandOptions in favor of OaktonOptions

test(HostedCommandsTester): update tests to use OaktonOptions and default command

tgardner commented 2 months ago

@jeremydmiller This should address your concerns with the scope disposal mentioned in https://github.com/JasperFx/oakton/pull/93#issuecomment-2329911998

Also added the ability to override the default command during the configuration stage, based on a discord conversation

jeremydmiller commented 2 months ago

@tgardner I got this one in, but one more really important thing (I took care of it), you needed to ensure that the IHost was disposed too so that it isn't hanging on to locks or resources or who knows what. Thanks for doing this!