Skip to content

Commit 27bb965

Browse files
authored
Merge pull request #5 from MORYX-Industry/cleanup/general-codestyle
Cleaned general code style
2 parents 5b77759 + 24d3323 commit 27bb965

File tree

16 files changed

+52
-63
lines changed

16 files changed

+52
-63
lines changed

Moryx.Cli.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Moryx/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/Moryx.Cli.Commands/AddModule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class AddModule
88
{
99
public static CommandResult Exec(TemplateSettings settings, string moduleName)
1010
{
11-
return CommandBase.Exec(settings, (filenames) =>
11+
return CommandBase.Exec(settings, (fileNames) =>
1212
AddThing.Exec(
1313
settings,
1414
new AddConfig
@@ -18,7 +18,7 @@ public static CommandResult Exec(TemplateSettings settings, string moduleName)
1818
Thing = "module",
1919
ThingPlaceholder = Template.Template.ModulePlaceholder,
2020
},
21-
filenames.Module(),
21+
fileNames.Module(),
2222
s => AddProjectsToSolution(settings, s)
2323
));
2424
}

src/Moryx.Cli.Commands/AddProducts.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,20 @@ public class AddProducts
99
{
1010
public static CommandResult Exec(TemplateSettings settings, IEnumerable<string> products)
1111
{
12-
return CommandBase.Exec(settings, (filenames) =>
13-
{
14-
return Add(settings, filenames, products);
15-
});
12+
return CommandBase.Exec(settings, (fileNames) => Add(settings, fileNames, products));
1613
}
1714

1815
private static CommandResult Add(TemplateSettings settings, List<string> cleanedResourceNames, IEnumerable<string> products)
1916
{
20-
var projectFilenames = cleanedResourceNames.InitialProjects();
17+
var projectFileNames = cleanedResourceNames.InitialProjects();
2118
var filteredResourceNames = cleanedResourceNames.Product();
2219

2320
var msg = new List<string>();
2421
foreach (var product in products)
2522
{
2623
try
2724
{
28-
var dictionary = Template.Template.PrepareFileStructure(settings.AppName, filteredResourceNames, projectFilenames);
25+
var dictionary = Template.Template.PrepareFileStructure(settings.AppName, filteredResourceNames, projectFileNames);
2926

3027
var files = Template.Template.WriteFilesToDisk(
3128
dictionary,

src/Moryx.Cli.Commands/AddStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static class AddStep
77
{
88
public static CommandResult Exec(TemplateSettings settings, string step)
99
{
10-
return CommandBase.Exec(settings, (filenames)
10+
return CommandBase.Exec(settings, (fileNames)
1111
=> AddThing.Exec(
1212
settings,
1313
new AddConfig
@@ -17,7 +17,7 @@ public static CommandResult Exec(TemplateSettings settings, string step)
1717
Thing = "step",
1818
ThingPlaceholder = Template.Template.StepPlaceholder,
1919
},
20-
filenames.Step()
20+
fileNames.Step()
2121
));
2222
}
2323
}

src/Moryx.Cli.Commands/AddSteps.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class AddSteps
88
{
99
public static CommandResult Exec(TemplateSettings settings, IEnumerable<string> cells)
1010
{
11-
return CommandBase.Exec(settings, (filenames)
11+
return CommandBase.Exec(settings, (fileNames)
1212
=> cells.Select(step => AddThing.Exec(
1313
settings,
1414
new AddConfig
@@ -18,7 +18,7 @@ public static CommandResult Exec(TemplateSettings settings, IEnumerable<string>
1818
Thing = "step",
1919
ThingPlaceholder = Template.Template.StepPlaceholder,
2020
},
21-
filenames.Step()
21+
fileNames.Step()
2222
))
2323
.ToArray()
2424
.Flatten());

src/Moryx.Cli.Commands/AddThing.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ public static class AddThing
77
{
88
public static CommandResult Exec(TemplateSettings settings, AddConfig config, List<string> resourceNames, Action<IEnumerable<string>>? onAddedFiles = null)
99
{
10-
return CommandBase.Exec(settings, (filenames) =>
10+
return CommandBase.Exec(settings, (fileNames) =>
1111
{
12-
var projectFilenames = filenames.InitialProjects();
12+
var projectFileNames = fileNames.InitialProjects();
1313

1414
try
1515
{
16-
var dictionary = Template.Template.PrepareFileStructure(config.SolutionName, resourceNames, projectFilenames);
16+
var dictionary = Template.Template.PrepareFileStructure(config.SolutionName, resourceNames, projectFileNames);
1717

1818
var files = Template.Template.WriteFilesToDisk(
1919
dictionary,

src/Moryx.Cli.Commands/CreateNew.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
using Moryx.Cli.Template.Extensions;
33
using Moryx.Cli.Template;
44
using Moryx.Cli.Template.Models;
5-
using System.Diagnostics.CodeAnalysis;
65
using Moryx.Cli.Commands.Extensions;
76

87
namespace Moryx.Cli.Commands
98
{
109
public static class CreateNew
1110
{
12-
public static CommandResult Solution(NewOptions options, [NotNull] Action<string> onStatus)
11+
public static CommandResult Solution(NewOptions options, Action<string> onStatus)
1312
{
1413
var solutionName = options.Name!;
1514
if (Directory.Exists(solutionName))
@@ -21,7 +20,7 @@ public static CommandResult Solution(NewOptions options, [NotNull] Action<string
2120
var settings = config.AsTemplateSettings(dir, solutionName);
2221
settings.Pull = options.Pull;
2322

24-
return CommandBase.Exec(settings, (filenames) =>
23+
return CommandBase.Exec(settings, _ =>
2524
{
2625
Directory.CreateDirectory(solutionName);
2726
CreateBareSolution(settings);
@@ -74,12 +73,12 @@ private static void InitializeGitRepo(string solutionName, Action<string> onStat
7473
{
7574
var initialDirectory = Environment.CurrentDirectory;
7675
Directory.SetCurrentDirectory(Path.Combine(Environment.CurrentDirectory, solutionName));
77-
var result = TemplateRepository.ExecCommanLine("git init", onStatus);
76+
var result = TemplateRepository.ExecCommandLine("git init", onStatus);
7877
if (result == 0)
7978
{
80-
TemplateRepository.ExecCommanLine("git checkout -b main", onStatus);
81-
TemplateRepository.ExecCommanLine("git add --all", onStatus);
82-
TemplateRepository.ExecCommanLine($"git commit -am \"Initial commit for {solutionName}\"", onStatus);
79+
TemplateRepository.ExecCommandLine("git checkout -b main", onStatus);
80+
TemplateRepository.ExecCommandLine("git add --all", onStatus);
81+
TemplateRepository.ExecCommandLine($"git commit -am \"Initial commit for {solutionName}\"", onStatus);
8382
onStatus("Initialized Git repository");
8483
}
8584
else

src/Moryx.Cli.Commands/ExecCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Moryx.Cli.Commands.Options;
1+
using System.Net;
2+
using Moryx.Cli.Commands.Options;
23
using System.Net.Http.Json;
34

45
namespace Moryx.Cli.Commands
@@ -51,6 +52,7 @@ internal static CommandResult PostSetup(ExecOptions options)
5152
internal class ModuleResponse
5253
{
5354
public string? Name { get; set; }
55+
5456
public string? HealthState { get; set; }
5557
}
5658
}

src/Moryx.Cli.Commands/Extensions/CommandResultExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{
33
internal static class CommandResultExtensions
44
{
5-
internal static CommandResult Flatten(this CommandResult[] results) {
5+
internal static CommandResult Flatten(this CommandResult[] results)
6+
{
67
if (results.Any(r => r.Error != null))
78
{
89
return CommandResult.WithError(string.Join("\n", results.Select(r => r.Error)));

src/Moryx.Cli.Template/Models/TemplateSettings.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
public class TemplateSettings
44
{
55
public string Branch { get; set; }
6+
67
public string Repository { get; set; }
8+
79
public bool Pull { get; set; }
10+
811
public string AppName { get; set; }
12+
913
public string ProfileName { get; set; } = "default";
14+
1015
public string TargetDirectory { get; set; }
11-
public string SourceDirectory { get => Path.Combine(TemplatesRoot(), ProfileName, Branch); }
1216

17+
public string SourceDirectory { get => Path.Combine(TemplatesRoot(), ProfileName, Branch); }
1318

1419
public string TemplatesRoot()
1520
=> Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Moryx.Cli");

0 commit comments

Comments
 (0)