@@ -33,20 +33,15 @@ internal class ToolExecuteCommand(ParseResult result, ToolManifestFinder? toolMa
3333 private readonly string ? _configFile = result . GetValue ( ToolExecuteCommandParser . ConfigOption ) ;
3434 private readonly string [ ] _sources = result . GetValue ( ToolExecuteCommandParser . SourceOption ) ?? [ ] ;
3535 private readonly string [ ] _addSource = result . GetValue ( ToolExecuteCommandParser . AddSourceOption ) ?? [ ] ;
36- private readonly bool _ignoreFailedSources = result . GetValue ( ToolCommandRestorePassThroughOptions . IgnoreFailedSourcesOption ) ;
3736 private readonly bool _interactive = result . GetValue ( ToolExecuteCommandParser . InteractiveOption ) ;
3837 private readonly VerbosityOptions _verbosity = result . GetValue ( ToolExecuteCommandParser . VerbosityOption ) ;
3938 private readonly bool _yes = result . GetValue ( ToolExecuteCommandParser . YesOption ) ;
39+ private readonly IToolPackageDownloader _toolPackageDownloader = ToolPackageFactory . CreateToolPackageStoresAndDownloader ( ) . downloader ;
4040
41- // TODO: Does result.OptionValuesToBeForwarded work here?
42- private readonly IToolPackageDownloader _toolPackageDownloader = ToolPackageFactory . CreateToolPackageStoresAndDownloader (
43- additionalRestoreArguments : result . OptionValuesToBeForwarded ( ToolExecuteCommandParser . GetCommand ( ) ) ) . downloader ;
44-
45- // TODO: Make sure to add these options to the command
4641 private readonly RestoreActionConfig _restoreActionConfig = new RestoreActionConfig ( DisableParallel : result . GetValue ( ToolCommandRestorePassThroughOptions . DisableParallelOption ) ,
4742 NoCache : result . GetValue ( ToolCommandRestorePassThroughOptions . NoCacheOption ) || result . GetValue ( ToolCommandRestorePassThroughOptions . NoHttpCacheOption ) ,
4843 IgnoreFailedSources : result . GetValue ( ToolCommandRestorePassThroughOptions . IgnoreFailedSourcesOption ) ,
49- Interactive : result . GetValue ( ToolCommandRestorePassThroughOptions . InteractiveRestoreOption ) ) ;
44+ Interactive : result . GetValue ( ToolExecuteCommandParser . InteractiveOption ) ) ;
5045
5146 private readonly ToolManifestFinder _toolManifestFinder = toolManifestFinder ?? new ToolManifestFinder ( new DirectoryPath ( currentWorkingDirectory ?? Directory . GetCurrentDirectory ( ) ) ) ;
5247
@@ -92,15 +87,12 @@ public override int Execute()
9287 sourceFeedOverrides : _sources ,
9388 additionalFeeds : _addSource ) ;
9489
95- var restoreActionConfig = new RestoreActionConfig (
96- IgnoreFailedSources : _ignoreFailedSources ,
97- Interactive : _interactive ) ;
98-
99- ( var bestVersion , var packageSource ) = _toolPackageDownloader . GetNuGetVersion ( packageLocation , packageId , _verbosity , versionRange , restoreActionConfig ) ;
90+ ( var bestVersion , var packageSource ) = _toolPackageDownloader . GetNuGetVersion ( packageLocation , packageId , _verbosity , versionRange , _restoreActionConfig ) ;
10091
10192 IToolPackage toolPackage ;
10293
103- // TODO: Add framework argument
94+ // TargetFramework is null, which means to use the current framework. Global tools can override the target framework to use (or select assets for),
95+ // but we don't support this for local or one-shot tools.
10496 if ( ! _toolPackageDownloader . TryGetDownloadedTool ( packageId , bestVersion , targetFramework : null , out toolPackage ) )
10597 {
10698 if ( ! UserAgreedToRunFromSource ( packageId , bestVersion , packageSource ) )
@@ -132,7 +124,7 @@ public override int Execute()
132124 verbosity : _verbosity ,
133125 versionRange : new VersionRange ( bestVersion , true , bestVersion , true ) ,
134126 isGlobalToolRollForward : false ,
135- restoreActionConfig : restoreActionConfig ) ;
127+ restoreActionConfig : _restoreActionConfig ) ;
136128 }
137129
138130 var commandSpec = ToolCommandSpecCreator . CreateToolCommandSpec ( toolPackage . Command . Name . Value , toolPackage . Command . Executable . Value , toolPackage . Command . Runner , _allowRollForward , _forwardArguments ) ;
@@ -153,8 +145,6 @@ private bool UserAgreedToRunFromSource(PackageId packageId, NuGetVersion version
153145 return false ;
154146 }
155147
156- // TODO: Use a better way to ask for user input
157- // TODO: How to localize y/n and interpret keys correctly? Does Spectre.Console handle this?
158148 string promptMessage = string . Format ( CliCommandStrings . ToolDownloadConfirmationPrompt , packageId , version . ToString ( ) , source . Source ) ;
159149
160150 static string AddPromptOptions ( string message )
0 commit comments