@@ -33,20 +33,15 @@ internal class ToolExecuteCommand(ParseResult result, ToolManifestFinder? toolMa
33
33
private readonly string ? _configFile = result . GetValue ( ToolExecuteCommandParser . ConfigOption ) ;
34
34
private readonly string [ ] _sources = result . GetValue ( ToolExecuteCommandParser . SourceOption ) ?? [ ] ;
35
35
private readonly string [ ] _addSource = result . GetValue ( ToolExecuteCommandParser . AddSourceOption ) ?? [ ] ;
36
- private readonly bool _ignoreFailedSources = result . GetValue ( ToolCommandRestorePassThroughOptions . IgnoreFailedSourcesOption ) ;
37
36
private readonly bool _interactive = result . GetValue ( ToolExecuteCommandParser . InteractiveOption ) ;
38
37
private readonly VerbosityOptions _verbosity = result . GetValue ( ToolExecuteCommandParser . VerbosityOption ) ;
39
38
private readonly bool _yes = result . GetValue ( ToolExecuteCommandParser . YesOption ) ;
39
+ private readonly IToolPackageDownloader _toolPackageDownloader = ToolPackageFactory . CreateToolPackageStoresAndDownloader ( ) . downloader ;
40
40
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
46
41
private readonly RestoreActionConfig _restoreActionConfig = new RestoreActionConfig ( DisableParallel : result . GetValue ( ToolCommandRestorePassThroughOptions . DisableParallelOption ) ,
47
42
NoCache : result . GetValue ( ToolCommandRestorePassThroughOptions . NoCacheOption ) || result . GetValue ( ToolCommandRestorePassThroughOptions . NoHttpCacheOption ) ,
48
43
IgnoreFailedSources : result . GetValue ( ToolCommandRestorePassThroughOptions . IgnoreFailedSourcesOption ) ,
49
- Interactive : result . GetValue ( ToolCommandRestorePassThroughOptions . InteractiveRestoreOption ) ) ;
44
+ Interactive : result . GetValue ( ToolExecuteCommandParser . InteractiveOption ) ) ;
50
45
51
46
private readonly ToolManifestFinder _toolManifestFinder = toolManifestFinder ?? new ToolManifestFinder ( new DirectoryPath ( currentWorkingDirectory ?? Directory . GetCurrentDirectory ( ) ) ) ;
52
47
@@ -92,15 +87,12 @@ public override int Execute()
92
87
sourceFeedOverrides : _sources ,
93
88
additionalFeeds : _addSource ) ;
94
89
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 ) ;
100
91
101
92
IToolPackage toolPackage ;
102
93
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.
104
96
if ( ! _toolPackageDownloader . TryGetDownloadedTool ( packageId , bestVersion , targetFramework : null , out toolPackage ) )
105
97
{
106
98
if ( ! UserAgreedToRunFromSource ( packageId , bestVersion , packageSource ) )
@@ -132,7 +124,7 @@ public override int Execute()
132
124
verbosity : _verbosity ,
133
125
versionRange : new VersionRange ( bestVersion , true , bestVersion , true ) ,
134
126
isGlobalToolRollForward : false ,
135
- restoreActionConfig : restoreActionConfig ) ;
127
+ restoreActionConfig : _restoreActionConfig ) ;
136
128
}
137
129
138
130
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
153
145
return false ;
154
146
}
155
147
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?
158
148
string promptMessage = string . Format ( CliCommandStrings . ToolDownloadConfirmationPrompt , packageId , version . ToString ( ) , source . Source ) ;
159
149
160
150
static string AddPromptOptions ( string message )
0 commit comments