Skip to content

Commit eab2653

Browse files
authored
Update to public beta5 of System.CommandLine (#240)
1 parent a34db5d commit eab2653

18 files changed

+59
-63
lines changed

nuget.config

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
<packageSources>
44
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
55
<clear />
6-
<add
7-
key="command-line-api"
8-
value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json"
9-
/>
106
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
117
</packageSources>
128
</configuration>

src/DotnetSops.CommandLine/Commands/DecryptCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77

88
namespace DotnetSops.CommandLine.Commands;
99

10-
internal class DecryptCommand : CliCommand
10+
internal class DecryptCommand : Command
1111
{
1212
public const string CommandName = "decrypt";
1313

1414
private readonly IServiceProvider _serviceProvider;
1515

16-
private readonly CliOption<FileInfo?> _projectFileOption = new("--project", "-p")
16+
private readonly Option<FileInfo?> _projectFileOption = new("--project", "-p")
1717
{
1818
Description = Properties.Resources.DecryptCommandProjectOptionDescription,
1919
};
2020

21-
private readonly CliOption<string?> _userSecretsIdOption = new("--id")
21+
private readonly Option<string?> _userSecretsIdOption = new("--id")
2222
{
2323
Description = Properties.Resources.DecryptCommandSecretsIdOptionDescription,
2424
};
2525

26-
private readonly CliOption<FileInfo> _inputFileOption = new("--file")
26+
private readonly Option<FileInfo> _inputFileOption = new("--file")
2727
{
2828
Description = Properties.Resources.DecryptCommandFileOptionDescription,
2929
DefaultValueFactory = _ => new FileInfo("secrets.json"),

src/DotnetSops.CommandLine/Commands/DownloadSopsCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace DotnetSops.CommandLine.Commands;
77

8-
internal class DownloadSopsCommand : CliCommand
8+
internal class DownloadSopsCommand : Command
99
{
1010
public const string CommandName = "download-sops";
1111

src/DotnetSops.CommandLine/Commands/EncryptCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88

99
namespace DotnetSops.CommandLine.Commands;
1010

11-
internal class EncryptCommand : CliCommand
11+
internal class EncryptCommand : Command
1212
{
1313
public const string CommandName = "encrypt";
1414

1515
private readonly IServiceProvider _serviceProvider;
1616

17-
private readonly CliOption<FileInfo?> _projectFileOption = new("--project", "-p")
17+
private readonly Option<FileInfo?> _projectFileOption = new("--project", "-p")
1818
{
1919
Description = Properties.Resources.EncryptCommandProjectOptionDescription,
2020
};
2121

22-
private readonly CliOption<string> _userSecretsIdOption = new("--id")
22+
private readonly Option<string> _userSecretsIdOption = new("--id")
2323
{
2424
Description = Properties.Resources.EncryptCommandSecretsIdOptionDescription,
2525
};
2626

27-
private readonly CliOption<FileInfo> _outputFileOption = new("--file")
27+
private readonly Option<FileInfo> _outputFileOption = new("--file")
2828
{
2929
Description = Properties.Resources.EncryptCommandFileOptionDescription,
3030
DefaultValueFactory = (_) => new FileInfo("secrets.json"),

src/DotnetSops.CommandLine/Commands/InitializeCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace DotnetSops.CommandLine.Commands;
99

10-
internal class InitializeCommand : CliCommand
10+
internal class InitializeCommand : Command
1111
{
1212
public const string CommandName = "init";
1313

src/DotnetSops.CommandLine/Commands/RootDotnetSopsCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace DotnetSops.CommandLine.Commands;
66

7-
internal class RootDotnetSopsCommand : CliRootCommand
7+
internal class RootDotnetSopsCommand : RootCommand
88
{
9-
private readonly CliOption<bool> _verboseOption = new("--verbose")
9+
private readonly Option<bool> _verboseOption = new("--verbose")
1010
{
1111
Recursive = true,
1212
Description = Properties.Resources.RootDotnetSopsCommandVerboseOptionDescription,

src/DotnetSops.CommandLine/Commands/RunCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
namespace DotnetSops.CommandLine.Commands;
77

8-
internal class RunCommand : CliCommand
8+
internal class RunCommand : Command
99
{
1010
public const string CommandName = "run";
1111

1212
private readonly IServiceProvider _serviceProvider;
1313

14-
private readonly CliOption<FileInfo> _inputFileOption = new("--file")
14+
private readonly Option<FileInfo> _inputFileOption = new("--file")
1515
{
1616
Description = Properties.Resources.RunCommandFileOptionDescription,
1717
DefaultValueFactory = _ => new FileInfo("secrets.json"),
1818
};
1919

20-
private readonly CliArgument<string[]> _runArguments = new("dotnetArguments")
20+
private readonly Argument<string[]> _runArguments = new("dotnetArguments")
2121
{
2222
Description = Properties.Resources.RunCommandArgumentsDescription,
2323
};

src/DotnetSops.CommandLine/DotnetSops.CommandLine.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.4" />
3535
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
3636
<PackageReference Include="Spectre.Console" Version="0.50.0" />
37-
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.24528.1" />
37+
<PackageReference Include="System.CommandLine" Version="2.0.0-beta5.25306.1" />
3838
<PackageReference Include="YamlDotNet" Version="16.3.0" />
3939
</ItemGroup>
4040
<ItemGroup>

src/DotnetSops.CommandLine/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
var rootCommand = new RootDotnetSopsCommand(serviceProvider);
4747

48-
var config = new CliConfiguration(rootCommand)
48+
var config = new CommandLineConfiguration(rootCommand)
4949
{
5050
Output = new ReplaceUsageHelpTextWriter(Console.Out),
5151
};

test/DotnetSops.CommandLine.Tests/Commands/DecryptCommandTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ await File.WriteAllTextAsync(
111111

112112
var inputPath = "secrets.json";
113113

114-
var config = new CliConfiguration(command);
114+
var config = new CommandLineConfiguration(command);
115115

116116
// Act
117117
var exitCode = await config.InvokeAsync($"--id {id} --file {inputPath}");
@@ -179,7 +179,7 @@ await File.WriteAllTextAsync(
179179

180180
var inputPath = "secrets.json";
181181

182-
var config = new CliConfiguration(command);
182+
var config = new CommandLineConfiguration(command);
183183

184184
// Act
185185
var exitCode = await config.InvokeAsync($"--id {id} --file {inputPath}");
@@ -205,7 +205,7 @@ public async Task DecryptCommand_InvalidInputFile_Fails()
205205

206206
var inputPath = "secrets.json";
207207

208-
var config = new CliConfiguration(command);
208+
var config = new CommandLineConfiguration(command);
209209

210210
// Act
211211
var exitCode = await config.InvokeAsync($"--id {id} --file {inputPath}");
@@ -291,7 +291,7 @@ await File.WriteAllTextAsync(
291291
"""
292292
);
293293

294-
var config = new CliConfiguration(command);
294+
var config = new CommandLineConfiguration(command);
295295

296296
// Act
297297
var exitCode = await config.InvokeAsync($"");
@@ -338,7 +338,7 @@ await File.WriteAllTextAsync(
338338
"""
339339
);
340340

341-
var config = new CliConfiguration(command);
341+
var config = new CommandLineConfiguration(command);
342342

343343
// Act
344344
var exitCode = await config.InvokeAsync($"");
@@ -394,7 +394,7 @@ public async Task HelpFlag_PrintHelp(string option)
394394
// Arrange
395395
var command = new RootDotnetSopsCommand(_serviceProvider);
396396
var output = new StringWriter();
397-
var config = new CliConfiguration(command)
397+
var config = new CommandLineConfiguration(command)
398398
{
399399
Output = new ReplaceUsageHelpTextWriter(output, "testhost"),
400400
};

0 commit comments

Comments
 (0)