File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
src/Cli/dotnet/Commands/Tool/Install
test/dotnet.Tests/CommandTests/Tool/Install Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ internal static class ToolInstallCommandParser
51
51
public static readonly Option < bool > CreateManifestIfNeededOption = new ( "--create-manifest-if-needed" )
52
52
{
53
53
Description = CliCommandStrings . CreateManifestIfNeededOptionDescription ,
54
- Arity = ArgumentArity . Zero ,
54
+ Arity = ArgumentArity . ZeroOrOne ,
55
55
DefaultValueFactory = _ => true ,
56
56
} ;
57
57
Original file line number Diff line number Diff line change @@ -127,13 +127,33 @@ public void WhenRunWithPackageIdItShouldSaveToCacheAndAddToManifestFile()
127
127
AssertDefaultInstallSuccess ( ) ;
128
128
}
129
129
130
+ [ Fact ]
131
+ public void GivenCreateManifestIfNeededWithoutArgumentTheDefaultIsTrueForLegacyBehavior ( )
132
+ {
133
+ _fileSystem . File . Delete ( _manifestFilePath ) ;
134
+ ParseResult parseResult =
135
+ Parser . Instance . Parse (
136
+ $ "dotnet tool install { _packageIdA . ToString ( ) } --create-manifest-if-needed") ;
137
+
138
+ var toolInstallLocalCommand = new ToolInstallLocalCommand (
139
+ parseResult ,
140
+ _packageIdA ,
141
+ _toolPackageDownloaderMock ,
142
+ _toolManifestFinder ,
143
+ _toolManifestEditor ,
144
+ _localToolsResolverCache ,
145
+ _reporter ) ;
146
+
147
+ toolInstallLocalCommand . Execute ( ) . Should ( ) . Be ( 0 ) ;
148
+ }
149
+
130
150
[ Fact ]
131
151
public void GivenNoManifestFileItShouldThrowAndContainNoManifestGuide ( )
132
152
{
133
153
_fileSystem . File . Delete ( _manifestFilePath ) ;
134
154
ParseResult parseResult =
135
155
Parser . Instance . Parse (
136
- $ "dotnet tool install { _packageIdA . ToString ( ) } --create-manifest-if-needed= false") ;
156
+ $ "dotnet tool install { _packageIdA . ToString ( ) } --create-manifest-if-needed false") ;
137
157
138
158
var toolInstallLocalCommand = new ToolInstallLocalCommand (
139
159
parseResult ,
You can’t perform that action at this time.
0 commit comments