Skip to content

Commit 0ac80aa

Browse files
committed
VersionBump : v4.6.0
1 parent 18ec6ab commit 0ac80aa

File tree

7 files changed

+60
-37
lines changed

7 files changed

+60
-37
lines changed

src/CodeOfChaos.CliArgsParser.Generators/CodeOfChaos.CliArgsParser.Generators.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<!-- Main package name -->
1313
<PackageId>CodeOfChaos.CliArgsParser.Generators</PackageId>
14-
<Version>4.5.0</Version>
14+
<Version>4.6.0</Version>
1515
<Authors>Anna Sas</Authors>
1616
<Description>CliArgsParser is a library built around Dependency Injection to allow you to create CLI tools with ease</Description>
1717
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-cli_args_parser/</PackageProjectUrl>

src/CodeOfChaos.CliArgsParser.Library/CodeOfChaos.CliArgsParser.Library.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- Main package name -->
1010
<PackageId>CodeOfChaos.CliArgsParser.Library</PackageId>
11-
<Version>4.5.0</Version>
11+
<Version>4.6.0</Version>
1212
<Authors>Anna Sas</Authors>
1313
<Description>CliArgsParser is a library built around Dependency Injection to allow you to create CLI tools with ease</Description>
1414
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-cli_args_parser/</PackageProjectUrl>

src/CodeOfChaos.CliArgsParser.Library/Commands/VersionBump/VersionBumpCommand.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ public async Task ExecuteAsync(VersionBumpParameters parameters) {
2525
}
2626

2727
SemanticVersionDto updatedVersion = bumpResult.AsSuccess.Value;
28-
29-
Console.WriteLine(ConsoleTextStore.GitCommitting);
30-
SuccessOrFailure gitCommitResult = await GitHelpers.TryCreateGitCommit(updatedVersion);
31-
if (gitCommitResult is { IsFailure: true, AsFailure.Value: var errorCommiting }) {
32-
Console.WriteLine(ConsoleTextStore.CommandEndFailure(errorCommiting));
33-
return;
34-
}
3528

36-
// Ask the user for extra input to make sure they want to push the current tag.
29+
// Ask the user for extra input to make sure they want to commit and the current tag.
3730
if (!parameters.Force) {
3831
Console.WriteLine(ConsoleTextStore.QuestionTagAndCommit);
39-
string? input = Console.ReadLine()?.ToLowerInvariant();
40-
if (input is not "y") {
32+
char? input = Console.ReadLine()?.ToLowerInvariant().FirstOrDefault();
33+
if (input is not 'y') {
4134
Console.WriteLine(ConsoleTextStore.CommandEndSuccess());
4235
return;
4336
}
4437
}
4538

39+
Console.WriteLine(ConsoleTextStore.GitCommitting);
40+
SuccessOrFailure gitCommitResult = await GitHelpers.TryCreateGitCommit(updatedVersion);
41+
if (gitCommitResult is { IsFailure: true, AsFailure.Value: var errorCommiting }) {
42+
Console.WriteLine(ConsoleTextStore.CommandEndFailure(errorCommiting));
43+
return;
44+
}
45+
4646
Console.WriteLine(ConsoleTextStore.GitTagging);
4747
SuccessOrFailure gitTagResult = await GitHelpers.TryCreateGitTag(updatedVersion);
4848
if (gitTagResult is { IsFailure: true, AsFailure.Value: var errorTagging }) {

src/CodeOfChaos.CliArgsParser.Library/Shared/ConsoleTextStore.cs

+44-22
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,54 @@ namespace CodeOfChaos.CliArgsParser.Library.Shared;
1111
public static class ConsoleTextStore {
1212
private static AnsiStringBuilder Builder { get; } = new();
1313

14-
public static string BumpingVersion => Builder.Fore.AppendWhitesmoke("Bumping version ...").ToStringAndClear();
15-
public static string GitCommitting => Builder.Fore.AppendWhitesmoke("Git committing ...").ToStringAndClear();
16-
public static string GitTagging => Builder.Fore.AppendWhitesmoke("Git tagging ...").ToStringAndClear();
17-
public static string GitPushingToRemote => Builder.Fore.AppendWhitesmoke("Pushing to origin ...").ToStringAndClear();
18-
public static string QuestionTagAndCommit => Builder.WithFore(f => f
14+
public static string BumpingVersion => Builder.Fore
15+
.AppendWhitesmoke("Defining and Bumping version ")
16+
.AppendSlategray("...")
17+
.ToStringAndClear();
18+
19+
public static string GitCommitting => Builder.Fore
20+
.AppendWhitesmoke("Git committing ")
21+
.AppendSlategray("...")
22+
.ToStringAndClear();
23+
24+
public static string GitTagging => Builder.Fore
25+
.AppendWhitesmoke("Git tagging ")
26+
.AppendSlategray("...")
27+
.ToStringAndClear();
28+
29+
public static string GitPushingToRemote => Builder.Fore
30+
.AppendWhitesmoke("Pushing to origin ")
31+
.AppendSlategray("...")
32+
.ToStringAndClear();
33+
34+
public static string QuestionTagAndCommit => Builder
35+
.WithFore(f => f
1936
.AppendWhitesmoke("Do you want to Git tag & push to origin?")
2037
.AppendSlategray(" (y/n)")
2138
).ToStringAndClear();
2239

23-
public static string CommandEndSuccess() => Builder.Fore.AppendGreen("Command completed successfully.").ToStringAndClear();
24-
public static string CommandEndFailure(string? failure) => Builder.Fore.WithFore(f => {
25-
f.AppendMaroon("Command failed");
26-
if (failure is not null) f.AppendMaroon(" : ").AppendWhitesmoke(failure);
27-
}
28-
).ToStringAndClear();
40+
public static string CommandEndSuccess() => Builder.Fore
41+
.AppendGreen("Command completed successfully.")
42+
.ToStringAndClear();
43+
44+
public static string CommandEndFailure(string? failure) => Builder.Fore
45+
.WithFore(f => {
46+
f.AppendCrimson("Command failed");
47+
if (failure is not null) f.AppendCrimson(" : ").AppendWhitesmoke(failure);
48+
}).ToStringAndClear();
2949

30-
public static string TagSuccessful(SemanticVersionDto versionDto) => Builder.WithFore(f => f
31-
.AppendWhitesmoke("Version ")
32-
.AppendDeepskyblue(versionDto.ToString())
33-
.AppendWhitesmoke(" successfully git tagged and committed.")
34-
).ToStringAndClear();
50+
public static string TagSuccessful(SemanticVersionDto versionDto) => Builder
51+
.WithFore(f => f
52+
.AppendWhitesmoke("Version ")
53+
.AppendDeepskyblue(versionDto.ToString())
54+
.AppendWhitesmoke(" successfully git tagged and committed.")
55+
).ToStringAndClear();
3556

36-
public static string UpdatedVersion(string projectName, string versionElement) => Builder.WithFore(f => f
37-
.AppendWhitesmoke("Updated version of package ")
38-
.AppendDeepskyblue(projectName)
39-
.AppendWhitesmoke(" to ")
40-
.AppendDeepskyblue(versionElement)
41-
).ToStringAndClear();
57+
public static string UpdatedVersion(string projectName, string versionElement) => Builder
58+
.WithFore(f => f
59+
.AppendWhitesmoke("Updated version of package ")
60+
.AppendDeepskyblue(projectName)
61+
.AppendWhitesmoke(" to ")
62+
.AppendDeepskyblue(versionElement)
63+
).ToStringAndClear();
4264
}

src/CodeOfChaos.CliArgsParser.Library/Shared/CsProjHelpers.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace CodeOfChaos.CliArgsParser.Library.Shared;
99
// Code
1010
// ---------------------------------------------------------------------------------------------------------------------
1111
public static class CsProjHelpers {
12-
public static string[] AsProjectPaths(string root, string sourcefolder, string[] projectNames) {
13-
return projectNames.Select(x => Path.Combine(root, sourcefolder, x, x + ".csproj")).ToArray();
12+
public static string[] AsProjectPaths(string root, string sourceFolder, string[] projectNames) {
13+
return projectNames.Select(x => Path.Combine(root, sourceFolder, x, x + ".csproj")).ToArray();
1414
}
1515

1616
public static async IAsyncEnumerable<XDocument> GetProjectFiles(string[] projectPaths) {

src/CodeOfChaos.CliArgsParser/CodeOfChaos.CliArgsParser.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- Main package name -->
99
<PackageId>CodeOfChaos.CliArgsParser</PackageId>
10-
<Version>4.5.0</Version>
10+
<Version>4.6.0</Version>
1111
<Authors>Anna Sas</Authors>
1212
<Description>CliArgsParser is a library built around Dependency Injection to allow you to create CLI tools with ease</Description>
1313
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-cli_args_parser/</PackageProjectUrl>

src/Tools.CodeOfChaos.CliArgsParser/Program.cs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public static async Task Main(string[] args) {
2121
// We are doing this here because else the launchSettings.json file becomes a humongous issue to deal with.
2222
// Sometimes CLI params is not the answer.
2323
// Code is the true saviour
24+
// const string projects = "";
2425
string projects = string.Join(";",
2526
"CodeOfChaos.CliArgsParser",
2627
"CodeOfChaos.CliArgsParser.Generators",

0 commit comments

Comments
 (0)