Skip to content

Commit 8304b3d

Browse files
Merge pull request #1398 from christianhelle/copilot/update-spectre-console-cli
Update Spectre.Console.Cli to 0.53.0 and fix breaking Execute signature
2 parents b7d17a5 + 9224284 commit 8304b3d

15 files changed

+46
-36
lines changed

src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCommandTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading;
23
using ApiClientCodeGen.Tests.Common.Infrastructure;
34
using AutoFixture.Xunit2;
45
using Rapicgen.CLI.Commands;
@@ -36,7 +37,7 @@ public void CreateGenerator_Should_NotNull(AutoRestCommand sut, AutoRestCommand.
3637
[Theory, AutoMoqData]
3738
public void Execute_Should_NotThrow(AutoRestCommand sut, AutoRestCommand.AutoRestSettings settings)
3839
{
39-
new Func<int>(() => sut.Execute(null, settings)).Should().NotThrow();
40+
new Func<int>(() => sut.Execute(null, settings, CancellationToken.None)).Should().NotThrow();
4041
}
4142

4243
[Theory, AutoMoqData]
@@ -121,7 +122,7 @@ public void OnExecute_Should_Create_Generator(
121122
AutoRestCommand sut,
122123
AutoRestCommand.AutoRestSettings settings)
123124
{
124-
sut.Execute(null, settings);
125+
sut.Execute(null, settings, CancellationToken.None);
125126

126127
Mock.Get(factory)
127128
.Verify(c => c.Create(

src/CLI/ApiClientCodeGen.CLI.Tests/Command/JMeterCommandTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Threading;
34
using ApiClientCodeGen.Tests.Common.Infrastructure;
45
using AutoFixture.Xunit2;
56
using Rapicgen.CLI.Commands;
@@ -31,7 +32,7 @@ public void OutputFile_Should_NotBeNullOrWhiteSpace(JMeterCommand.Settings setti
3132
public void Execute_Should_NotThrow(JMeterCommand sut, JMeterCommand.Settings settings)
3233
{
3334
settings.OutputPath = Directory.GetCurrentDirectory();
34-
new Func<int>(() => sut.Execute(null, settings)).Should().NotThrow();
35+
new Func<int>(() => sut.Execute(null, settings, CancellationToken.None)).Should().NotThrow();
3536
}
3637

3738
[Theory, AutoMoqData]
@@ -41,7 +42,7 @@ public void Execute_Should_Create_Generator(
4142
JMeterCommand.Settings settings)
4243
{
4344
settings.OutputPath = Directory.GetCurrentDirectory();
44-
sut.Execute(null, settings);
45+
sut.Execute(null, settings, CancellationToken.None);
4546

4647
Mock.Get(factory)
4748
.Verify(c => c.Create(
@@ -65,7 +66,7 @@ public void Execute_Should_Write_To_IConsole(
6566

6667
settings.OutputPath = path.FullName;
6768
settings.SkipLogging = false;
68-
sut.Execute(null, settings);
69+
sut.Execute(null, settings, CancellationToken.None);
6970

7071
Mock.Get(factory)
7172
.Verify(c => c.Create(

src/CLI/ApiClientCodeGen.CLI.Tests/Command/NSwagCommandTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading;
23
using ApiClientCodeGen.Tests.Common.Infrastructure;
34
using AutoFixture.Xunit2;
45
using Rapicgen.CLI.Commands;
@@ -41,7 +42,7 @@ public void Execute_Should_NotThrow(
4142
.Setup(c => c.GenerateCode(progressReporter))
4243
.Returns(code);
4344

44-
new Func<int>(() => sut.Execute(null, settings)).Should().NotThrow();
45+
new Func<int>(() => sut.Execute(null, settings, CancellationToken.None)).Should().NotThrow();
4546
}
4647
}
4748
}

src/CLI/ApiClientCodeGen.CLI.Tests/Command/OpenApiCSharpGeneratorCommandTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading;
23
using ApiClientCodeGen.Tests.Common.Infrastructure;
34
using AutoFixture.Xunit2;
45
using Rapicgen.CLI.Commands;
@@ -42,7 +43,7 @@ public void Execute_Should_NotThrow(
4243
.Setup(c => c.GenerateCode(progressReporter))
4344
.Returns(code);
4445

45-
new Func<int>(() => sut.Execute(null, settings)).Should().NotThrow();
46+
new Func<int>(() => sut.Execute(null, settings, CancellationToken.None)).Should().NotThrow();
4647
}
4748
}
4849
}

src/CLI/ApiClientCodeGen.CLI.Tests/Command/OpenApiGeneratorCommandTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Threading;
34
using ApiClientCodeGen.Tests.Common.Infrastructure;
45
using AutoFixture.Xunit2;
56
using Rapicgen.CLI.Commands;
@@ -30,7 +31,7 @@ public void OutputFile_Should_NotBeNullOrWhiteSpace(OpenApiGeneratorCommandSetti
3031
public void Execute_Should_NotThrow(OpenApiGeneratorCommand sut, OpenApiGeneratorCommandSettings settings)
3132
{
3233
settings.OutputPath = Directory.GetCurrentDirectory();
33-
new Func<int>(() => sut.Execute(null, settings)).Should().NotThrow();
34+
new Func<int>(() => sut.Execute(null, settings, CancellationToken.None)).Should().NotThrow();
3435
}
3536

3637
[Theory, AutoMoqData]
@@ -40,7 +41,7 @@ public void Execute_Should_Create_Generator(
4041
OpenApiGeneratorCommandSettings settings)
4142
{
4243
settings.OutputPath = Directory.GetCurrentDirectory();
43-
sut.Execute(null, settings);
44+
sut.Execute(null, settings, CancellationToken.None);
4445

4546
Mock.Get(factory)
4647
.Verify(c => c.Create(
@@ -64,7 +65,7 @@ public void Execute_Should_Write_To_IConsole(
6465

6566
settings.OutputPath = path.FullName;
6667
settings.SkipLogging = false;
67-
sut.Execute(null, settings);
68+
sut.Execute(null, settings, CancellationToken.None);
6869

6970
Mock.Get(factory)
7071
.Verify(c => c.Create(

src/CLI/ApiClientCodeGen.CLI.Tests/Command/RefitterCommandTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.ComponentModel.DataAnnotations;
1010
using System.IO;
11+
using System.Threading;
1112
using Xunit;
1213

1314
namespace Rapicgen.CLI.Tests.Command;
@@ -25,7 +26,7 @@ public void Should_Create_From_Factory(
2526
{
2627
// Ensure SettingsFile is null for this test
2728
settings.SettingsFile = null;
28-
sut.Execute(null, settings);
29+
sut.Execute(null, settings, CancellationToken.None);
2930
Mock.Get(factory)
3031
.Verify(f => f.Create(
3132
settings.SwaggerFile,
@@ -49,7 +50,7 @@ public void Should_Create_From_Factory_With_Settings_File(
4950
try
5051
{
5152
settings.SettingsFile = tempFile;
52-
sut.Execute(null, settings);
53+
sut.Execute(null, settings, CancellationToken.None);
5354

5455
// Verify that SwaggerFile was updated to match SettingsFile
5556
Assert.Equal(tempFile, settings.SwaggerFile);

src/CLI/ApiClientCodeGen.CLI.Tests/Command/SwaggerCodegenCommandTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading;
23
using ApiClientCodeGen.Tests.Common.Infrastructure;
34
using AutoFixture.Xunit2;
45
using Rapicgen.CLI.Commands;
@@ -41,7 +42,7 @@ public void Execute_Should_NotThrow(
4142
.Setup(c => c.GenerateCode(progressReporter))
4243
.Returns(code);
4344

44-
new Func<int>(() => sut.Execute(null, settings)).Should().NotThrow();
45+
new Func<int>(() => sut.Execute(null, settings, CancellationToken.None)).Should().NotThrow();
4546
}
4647
}
4748
}

src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<Nullable>enable</Nullable>
2828
</PropertyGroup>
2929
<ItemGroup>
30-
<PackageReference Include="Spectre.Console.Cli" Version="0.52.0" />
30+
<PackageReference Include="Spectre.Console.Cli" Version="0.53.0" />
3131
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
3232
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
3333
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />

src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/CSharpCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics.CodeAnalysis;
2+
using System.Threading;
23
using Spectre.Console.Cli;
34

45
namespace Rapicgen.CLI.Commands.CSharp
@@ -10,7 +11,7 @@ public class Settings : CommandSettings
1011
{
1112
}
1213

13-
public override int Execute(CommandContext context, Settings settings)
14+
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
1415
{
1516
// This will be handled by subcommands
1617
return 0;

src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/RefitterCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.ComponentModel.DataAnnotations;
44
using System.Diagnostics.CodeAnalysis;
55
using System.IO;
6+
using System.Threading;
67
using Rapicgen.CLI.Commands;
78
using Rapicgen.Core;
89
using Rapicgen.Core.Generators;
@@ -72,7 +73,7 @@ public RefitterCommand(
7273
this.dependencyInstaller = dependencyInstaller;
7374
}
7475

75-
public override int Execute(CommandContext context, RefitterCommandSettings settings)
76+
public override int Execute(CommandContext context, RefitterCommandSettings settings, CancellationToken cancellationToken)
7677
{
7778
// Map settings to options
7879
options.GenerateContracts = !settings.SkipGenerateContracts;
@@ -98,7 +99,7 @@ public override int Execute(CommandContext context, RefitterCommandSettings sett
9899
}
99100

100101
// Call the base implementation
101-
return base.Execute(context, settings);
102+
return base.Execute(context, settings, cancellationToken);
102103
}
103104

104105
public override ICodeGenerator CreateGenerator(RefitterCommandSettings settings) =>

0 commit comments

Comments
 (0)