Skip to content

Commit 23dd3b7

Browse files
committed
Move hard-coded text and strings to the resources file
#92
1 parent a599b39 commit 23dd3b7

64 files changed

Lines changed: 756 additions & 700 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/FlowCtl/ApplicationBuilders/CliApplicationBuilder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.CommandLine;
1+
using System.CommandLine;
32
using System.CommandLine.Builder;
43
using System.CommandLine.Parsing;
54
using Microsoft.Extensions.DependencyInjection;

src/FlowCtl/Commands/Config/Add/AddConfigCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ namespace FlowCtl.Commands.Config.Add;
44

55
internal class AddConfigCommand : BaseCommand<AddConfigCommandOptions, AddConfigCommandOptionsHandler>
66
{
7-
public AddConfigCommand() : base("add", Resources.AddConfigCommandDescription)
7+
public AddConfigCommand() : base("add", Resources.Commands_AddConfig_Description)
88
{
99
var dataOption = new Option<string?>(new[] { "-d", "--data" },
10-
description: Resources.CommandFieldOption) { IsRequired = true };
10+
description: Resources.Commands_AddConfig_Data);
1111

1212
var dataFileOption = new Option<string?>(new[] { "-f", "--data-file" },
13-
description: Resources.InvokeCommandDataFileOption);
13+
description: Resources.Commands_AddConfig_DataFile);
1414

1515
var addressOption = new Option<string?>(new[] { "-a", "--address" },
16-
description: Resources.CommandAddressOption);
16+
description: Resources.Commands_FlowSynxAddress);
1717

1818
AddOption(dataOption);
1919
AddOption(dataFileOption);

src/FlowCtl/Commands/Config/Add/AddConfigCommandOptionsHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private async Task Execute(AddConfigCommandOptions options, CancellationToken ca
4747
if (!string.IsNullOrEmpty(options.DataFile))
4848
{
4949
if (!File.Exists(options.DataFile))
50-
throw new Exception($"Entered data file '{options.DataFile}' is not exist.");
50+
throw new Exception(string.Format(Resources.Commands_AddConfig_DataFileDoesNotExist, options.DataFile));
5151

5252
jsonData = await File.ReadAllTextAsync(options.DataFile, cancellationToken);
5353
}
@@ -60,7 +60,7 @@ private async Task Execute(AddConfigCommandOptions options, CancellationToken ca
6060
var result = await _flowSynxClient.AddPluginConfig(request, cancellationToken);
6161

6262
if (result.StatusCode != 200)
63-
throw new Exception(Resources.ErrorOccurredDuringProcessingRequest);
63+
throw new Exception(Resources.Commands_Error_DuringProcessingRequest);
6464

6565
var payload = result.Payload;
6666
if (payload is { Succeeded: false })

src/FlowCtl/Commands/Config/ConfigCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ namespace FlowCtl.Commands.Config;
88

99
internal class ConfigCommand : BaseCommand<ConfigCommandOptions, ConfigCommandOptionsHandler>
1010
{
11-
public ConfigCommand() : base("config", Resources.ConfigCommandDescription)
11+
public ConfigCommand() : base("config", Resources.Commands_Config_Description)
1212
{
1313
var addressOption = new Option<string?>(new[] { "-a", "--address" },
14-
description: Resources.CommandAddressOption);
14+
description: Resources.Commands_FlowSynxAddress);
1515

1616
var outputOption = new Option<OutputType>(new[] { "-o", "--output" },
1717
getDefaultValue: () => OutputType.Json,
18-
description: Resources.CommandOutputOption);
18+
description: Resources.Commands_Output_Format);
1919

2020
AddOption(addressOption);
2121
AddOption(outputOption);

src/FlowCtl/Commands/Config/ConfigCommandOptionsHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private async Task Execute(ConfigCommandOptions options, CancellationToken cance
4040
var result = await _flowSynxClient.PluginConfigList(cancellationToken);
4141

4242
if (result.StatusCode != 200)
43-
throw new Exception(Resources.ErrorOccurredDuringProcessingRequest);
43+
throw new Exception(Resources.Commands_Error_DuringProcessingRequest);
4444

4545
var payload = result.Payload;
4646
if (payload is { Succeeded: false })

src/FlowCtl/Commands/Config/Delete/DeleteConfigCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ namespace FlowCtl.Commands.Config.Delete;
44

55
internal class DeleteConfigCommand : BaseCommand<DeleteConfigCommandOptions, DeleteConfigCommandOptionsHandler>
66
{
7-
public DeleteConfigCommand() : base("delete", Resources.DeleteConfigCommandDescription)
7+
public DeleteConfigCommand() : base("delete", Resources.Commands_DeleteConfig_Description)
88
{
99
var identityOption = new Option<string>(new[] { "-i", "--id" },
10-
description: Resources.CommandFieldOption) { IsRequired = true };
10+
description: Resources.Commands_DeleteConfig_IdentityOption) { IsRequired = true };
1111

1212
var addressOption = new Option<string?>(new[] { "-a", "--address" },
13-
description: Resources.CommandAddressOption);
13+
description: Resources.Commands_FlowSynxAddress);
1414

1515
AddOption(identityOption);
1616
AddOption(addressOption);

src/FlowCtl/Commands/Config/Delete/DeleteConfigCommandOptionsHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private async Task Execute(DeleteConfigCommandOptions options, CancellationToken
4242
var result = await _flowSynxClient.DeletePluginConfig(request, cancellationToken);
4343

4444
if (result.StatusCode != 200)
45-
throw new Exception(Resources.ErrorOccurredDuringProcessingRequest);
45+
throw new Exception(Resources.Commands_Error_DuringProcessingRequest);
4646

4747
var payload = result.Payload;
4848
if (payload is { Succeeded: false })

src/FlowCtl/Commands/Config/Details/DetailsConfigCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace FlowCtl.Commands.Config.Details;
55

66
internal class DetailsConfigCommand : BaseCommand<DetailsConfigCommandOptions, DetailsConfigCommandOptionsHandler>
77
{
8-
public DetailsConfigCommand() : base("details", Resources.DetailsConfigCommandDescription)
8+
public DetailsConfigCommand() : base("details", Resources.Commands_DetailsConfig_Description)
99
{
1010
var identityOption = new Option<string>(new[] { "-i", "--id" },
11-
description: Resources.DetailsConfigCommandNameOption) { IsRequired = true };
11+
description: Resources.Commands_DetailsConfig_IdentityOption) { IsRequired = true };
1212

1313
var outputFormatOption = new Option<OutputType>(new[] { "-o", "--output" },
1414
getDefaultValue: () => OutputType.Json,
15-
description: Resources.CommandOutputOption);
15+
description: Resources.Commands_Output_Format);
1616

1717
AddOption(identityOption);
1818
AddOption(outputFormatOption);

src/FlowCtl/Commands/Config/Details/DetailsConfigCommandOptionsHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private async Task Execute(DetailsConfigCommandOptions options, CancellationToke
4242
var result = await _flowSynxClient.PluginConfigDetails(request, cancellationToken);
4343

4444
if (result.StatusCode != 200)
45-
throw new Exception(Resources.ErrorOccurredDuringProcessingRequest);
45+
throw new Exception(Resources.Commands_Error_DuringProcessingRequest);
4646

4747
var payload = result.Payload;
4848
if (payload is { Succeeded: false })

src/FlowCtl/Commands/Health/HealthCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace FlowCtl.Commands.Health;
55

66
internal class HealthCommand : BaseCommand<HealthCommandOptions, HealthCommandOptionsHandler>
77
{
8-
public HealthCommand() : base("health", Resources.HealthCommandDescription)
8+
public HealthCommand() : base("health", Resources.Commands_Health_Description)
99
{
1010
var addressOption = new Option<string?>(new[] { "-a", "--address" },
11-
description: Resources.CommandAddressOption);
11+
description: Resources.Commands_FlowSynxAddress);
1212

1313
var outputOption = new Option<OutputType>(new[] { "-o", "--output" },
1414
getDefaultValue: () => OutputType.Json,
15-
description: Resources.CommandOutputOption);
15+
description: Resources.Commands_Output_Format);
1616

1717
AddOption(addressOption);
1818
AddOption(outputOption);

0 commit comments

Comments
 (0)