Skip to content

Commit 2bd1956

Browse files
committed
Update packages, docs, and add new features
- Updated `Roslynator.Analyzers` to `4.12.9` in `Directory.Build.props`. - Updated copyright year to 2024 in `LICENSE`. - Removed "Introduction" section from `README.md` and `README_NUGET.md`. - Updated .NET version to `net8.0` in `README.md`. - Added `help` command in `Program.cs` for usage instructions. - Enhanced `ShowBot` method in `Program.cs` to display runtime and version info. - Changed template in `BootstrapLibraWebApiSolution` method to `gnx-librawebapi`. - Refactored `WriteColorEx` method in `Program.cs` to use PascalCase for parameter names. - Renamed profile in `launchSettings.json` to `gnx-cli`.
1 parent f268ab5 commit 2bd1956

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Nullable>enable</Nullable>
1010
</PropertyGroup>
1111
<ItemGroup>
12-
<PackageReference Include="Roslynator.Analyzers" Version="4.12.3">
12+
<PackageReference Include="Roslynator.Analyzers" Version="4.12.9">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1515
</PackageReference>

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Genocs Services
3+
Copyright (c) 2024 Genocs Services
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545

4646
# Genocs cli
4747

48-
Another component for the Genocs ecosystem.
49-
5048
## Introduction
5149

5250
Genocs cli is the Genocs **dotnet tool** that allow you to use Genocs templates.
@@ -97,11 +95,11 @@ dotnet pack -p:PackageVersion={semver} --output nupkgs
9795
dotnet pack --output nupkgs
9896

9997
# Run the tool to install the templates
100-
dotnet run -f net7.0 --project ./src/genocs.cli.csproj genocs -i
98+
dotnet run -f net8.0 --project ./src/genocs.cli.csproj genocs -i
10199

102100
# Run the tool to install the templates (some as above with cd command)
103101
cd ./src
104-
dotnet run -f net7.0 genocs -i
102+
dotnet run -f net8.0 genocs -i
105103

106104
# Install the tool from local folder to the global cache
107105
dotnet tool install --global --add-source ./nupkgs genocs.cli

src/Program.cs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22

33
using Genocs.CLI;
44
using System.Diagnostics;
5+
using System.Reflection;
56
using System.Text.RegularExpressions;
67

78
if (args.Length == 0)
89
{
910
ShowBot(string.Empty);
10-
Console.WriteLine("Missing params. Use following syntax:");
11-
WriteColorConsole(" genocs [i|install|u|update]", ConsoleColor.Cyan);
12-
Console.WriteLine("then follow with:");
13-
WriteColorConsole(" genocs [blazor-clean|blazor-wasm|clean-webapi|libra-webapi|micro-webapi|angular|react] [n|new] <CompanyName.ProjectName.ServiceName>", ConsoleColor.Cyan);
14-
Console.WriteLine("\nPlease refer to https://genocs-blog.netlify.app/");
1511
return;
1612
}
1713

@@ -161,6 +157,16 @@
161157
return;
162158
}
163159

160+
if (firstArg == "h" || firstArg == "help")
161+
{
162+
WriteColorConsole(" genocs [i|install|u|update]", ConsoleColor.Cyan);
163+
Console.WriteLine("then follow with:");
164+
WriteColorConsole(" genocs [blazor-clean|blazor-wasm|clean-webapi|libra-webapi|micro-webapi|angular|react] [n|new] <CompanyName.ProjectName.ServiceName>", ConsoleColor.Cyan);
165+
Console.WriteLine("\nPlease refer to https://genocs-blog.netlify.app/");
166+
167+
return;
168+
}
169+
164170
// Fallback
165171
WriteColorConsole("Sorry I don't understand your command!", ConsoleColor.DarkRed);
166172
WriteColorConsole("Accepted syntax is something like:", ConsoleColor.Cyan);
@@ -180,6 +186,10 @@ static void ShowBot(string message)
180186
..######...########.##....##..#######...######...######............######..########.####
181187
";
182188
WriteColorConsole(bot, ConsoleColor.Blue);
189+
WriteColorConsole($"Runtime: {Environment.Version}", ConsoleColor.DarkGreen);
190+
WriteColorConsole($"Version: {Assembly.GetExecutingAssembly().GetName().Version}", ConsoleColor.DarkGreen);
191+
WriteColorConsole($"Please type: 'genocs help' to get more info.", ConsoleColor.Blue);
192+
183193
}
184194

185195
static void WriteColor(string message, ConsoleColor color)
@@ -288,7 +298,7 @@ async Task BootstrapLibraWebApiSolution(string projectName)
288298
var psi = new ProcessStartInfo
289299
{
290300
FileName = "dotnet",
291-
Arguments = $"new gnx-webapi -n {projectName} -o {projectName} -v=q"
301+
Arguments = $"new gnx-librawebapi -n {projectName} -o {projectName} -v=q"
292302
};
293303
using var proc = Process.Start(psi)!;
294304
await proc.WaitForExitAsync();
@@ -322,17 +332,17 @@ static void WriteSuccessMessage(string message)
322332
WriteColorConsole(message, ConsoleColor.Green);
323333
}
324334

325-
static void WriteColorEx(string str, params (string substring, ConsoleColor color)[] colors)
335+
static void WriteColorEx(string str, params (string SubString, ConsoleColor Color)[] colors)
326336
{
327337
string[] words = Regex.Split(str, @"( )");
328338

329339
foreach (string word in words)
330340
{
331-
(string substring, ConsoleColor color) cl = colors.FirstOrDefault(x => x.substring.Equals("{" + word + "}"));
332-
if (cl.substring != null)
341+
(string SubString, ConsoleColor Color) cl = colors.FirstOrDefault(x => x.SubString.Equals("{" + word + "}"));
342+
if (cl.SubString != null)
333343
{
334-
Console.ForegroundColor = cl.color;
335-
Console.Write(cl.substring.Substring(1, cl.substring.Length - 2));
344+
Console.ForegroundColor = cl.Color;
345+
Console.Write(cl.SubString.Substring(1, cl.SubString.Length - 2));
336346
Console.ResetColor();
337347
}
338348
else

src/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"profiles": {
3-
"genocs.cli": {
3+
"gnx-cli": {
44
"commandName": "Project",
55
"commandLineArgs": "u"
66
}

src/README_NUGET.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343

4444
# Genocs cli
4545

46-
Another component for the Genocs ecosystem.
4746

4847
## Introduction
4948

0 commit comments

Comments
 (0)