Skip to content

Commit fd43121

Browse files
committed
Added capital case
1 parent 5ed9ebf commit fd43121

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

src/Program.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// See https://aka.ms/new-console-template for more information
22

3+
using Genocs.CLI;
34
using System.Diagnostics;
45
using System.Reflection;
56
using System.Text.RegularExpressions;
@@ -41,8 +42,8 @@
4142
}
4243

4344
string command = args[1].Trim().ToLower();
44-
// Convert to Capital case
45-
string projectName = args[2].Trim().ToLower();
45+
string projectName = args[2].Trim().ToCapitalCase();
46+
4647
if (command == "n" || command == "new")
4748
{
4849
await BootstrapAngularSolution(projectName);
@@ -60,8 +61,8 @@
6061
}
6162

6263
string command = args[1].Trim().ToLower();
63-
// Convert to Capital case
64-
string projectName = args[2].Trim().ToLower();
64+
string projectName = args[2].Trim().ToCapitalCase();
65+
6566
if (command == "n" || command == "new")
6667
{
6768
await BootstrapBlazorSolution(projectName);
@@ -79,8 +80,8 @@
7980
}
8081

8182
string command = args[1].Trim().ToLower();
82-
// Convert to Capital case
83-
string projectName = args[2].Trim().ToLower();
83+
string projectName = args[2].Trim().ToCapitalCase();
84+
8485
if (command == "n" || command == "new")
8586
{
8687
await BootstrapBlazorSolution(projectName);
@@ -98,8 +99,8 @@
9899
}
99100

100101
string command = args[1].Trim().ToLower();
101-
// Convert to Capital case
102-
string projectName = args[2].Trim().ToLower();
102+
string projectName = args[2].Trim().ToCapitalCase();
103+
103104
if (command == "n" || command == "new")
104105
{
105106
await BootstrapMicroserviceSolution(projectName);
@@ -117,9 +118,8 @@
117118
}
118119

119120
string command = args[1].Trim().ToLower();
120-
// Convert to Capital case
121-
// Convert to Capital case
122-
string projectName = args[2].Trim().ToLower();
121+
string projectName = args[2].Trim().ToCapitalCase();
122+
123123
if (command == "n" || command == "new")
124124
{
125125
await BootstrapCleanArchitectureSolution(projectName);

src/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Please check the GitHub repository getting more info.
1414

1515
## Release notes
1616

17+
### [2023-07-10] 0.0.4
18+
- Added capitalCase on the project name
19+
1720
### [2023-06-03] 0.0.3
1821
- Updated syntax to .Net 7.0
1922

src/StringExtensions.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Text;
2+
3+
namespace Genocs.CLI;
4+
5+
public static class StringExtensions
6+
{
7+
public static string ToCapitalCase(this string str)
8+
{
9+
// Implement capital case logic here
10+
if (str == null)
11+
{
12+
throw new ArgumentNullException(nameof(str));
13+
}
14+
if (str.Length == 0)
15+
{
16+
return str;
17+
}
18+
19+
// Split the string into words separated by a space character or period
20+
var splitString = str.Split(' ', '.');
21+
var sb = new StringBuilder();
22+
foreach (var word in splitString)
23+
{
24+
// Capitalize the first letter of each word
25+
sb.Append(char.ToUpper(word[0]));
26+
// Add the rest of the word as is
27+
sb.Append(word.Substring(1));
28+
// Add a space character after each word
29+
sb.Append('.');
30+
}
31+
32+
return sb.ToString(0, sb.Length - 1);
33+
}
34+
}

src/genocs.cli.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Nullable>enable</Nullable>
88
<PackAsTool>true</PackAsTool>
99
<ToolCommandName>genocs</ToolCommandName>
10-
<PackageVersion>0.0.3</PackageVersion>
10+
<PackageVersion>0.0.4</PackageVersion>
1111
<PackageOutputPath>./nupkg</PackageOutputPath>
1212
<PackageId>Genocs.CLI</PackageId>
1313
<Title>Genocs CLI Tool</Title>
@@ -19,7 +19,7 @@
1919
<PackageReadmeFile>README.md</PackageReadmeFile>
2020
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2121
<PackageIcon>icon.png</PackageIcon>
22-
<VersionPrefix>0.0.3</VersionPrefix>
22+
<VersionPrefix>0.0.4</VersionPrefix>
2323
</PropertyGroup>
2424

2525
<ItemGroup>

0 commit comments

Comments
 (0)