Skip to content

Commit 4e4773d

Browse files
fix(deps): bump ConsoleAppFramework from 3.3.2 to 4.0.1 (#54)
1 parent c7861c5 commit 4e4773d

File tree

4 files changed

+36
-59
lines changed

4 files changed

+36
-59
lines changed

sandbox/ConsoleAppExample/AppBase.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

sandbox/ConsoleAppExample/ConsoleAppExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="ConsoleAppFramework" Version="3.3.2" />
10+
<PackageReference Include="ConsoleAppFramework" Version="4.0.1" />
1111
</ItemGroup>
1212

1313
<ItemGroup>
Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
using ConsoleAppExample;
2-
using ConsoleAppFramework;
3-
using Microsoft.Extensions.Hosting;
2+
using Microsoft.Extensions.Logging;
43
using Nogic.WritableOptions;
54

6-
await Host.CreateDefaultBuilder()
7-
.ConfigureLogging(logging => logging.ReplaceToSimpleConsole())
8-
.ConfigureServices((context, services) =>
9-
{
10-
// Load app settings
11-
var config = context.Configuration;
12-
services.ConfigureWritable<AppOption>(config.GetSection(context.HostingEnvironment.ApplicationName));
13-
})
14-
.RunConsoleAppFrameworkAsync<AppBase>(args)
15-
.ConfigureAwait(false);
5+
var builder = ConsoleApp.CreateBuilder(args);
6+
builder.ConfigureServices((ctx, services) =>
7+
{
8+
// Load app settings
9+
var config = ctx.Configuration;
10+
services.ConfigureWritable<AppOption>(config.GetSection(ctx.HostingEnvironment.ApplicationName));
11+
});
12+
13+
var app = builder.Build();
14+
app.AddRootCommand((ConsoleAppContext ctx, IWritableOptions<AppOption> writableOptions) =>
15+
{
16+
ctx.Logger.LogDebug("Start.");
17+
18+
var currentOption = writableOptions.Value;
19+
ctx.Logger.LogInformation("Current Settings: {currentOption}", currentOption);
20+
21+
var newOption = new AppOption { LastLaunchedAt = ctx.Timestamp, ApiKey = Guid.NewGuid().ToString() };
22+
ctx.Logger.LogInformation("New Settings: {newOption}", newOption);
23+
24+
ctx.Logger.LogInformation("Try to write new settings.");
25+
writableOptions.Update(newOption);
26+
ctx.Logger.LogInformation("Success! Check your appsettings.json.");
27+
28+
ctx.Logger.LogDebug("End.");
29+
});
30+
31+
app.Run();

sandbox/ConsoleAppExample/packages.lock.json

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
"net6.0": {
55
"ConsoleAppFramework": {
66
"type": "Direct",
7-
"requested": "[3.3.2, )",
8-
"resolved": "3.3.2",
9-
"contentHash": "UEUJ1ToLuBz1sHe4BTp9xsvL3rashWEUFZb8QXgZWztW9/ZVptEEOhGsYCJ51WhAmXKI3422u6/mb1Kav7G21w==",
7+
"requested": "[4.0.1, )",
8+
"resolved": "4.0.1",
9+
"contentHash": "rt2b90zZ+opmZYwb4lMKipEzsS/eQ8mdozjhNiupdmtMuDWWIA4l8KhECZxbN35hLo1dOfdXHafp3oYvGYD37Q==",
1010
"dependencies": {
11-
"Microsoft.Extensions.Hosting": "3.1.5",
12-
"System.Text.Json": "4.7.2",
13-
"System.Threading.Tasks.Extensions": "4.5.4"
11+
"Microsoft.Extensions.Hosting": "6.0.0",
12+
"System.Text.Json": "6.0.1"
1413
}
1514
},
1615
"Microsoft.Extensions.Configuration": {
@@ -304,18 +303,13 @@
304303
},
305304
"System.Text.Json": {
306305
"type": "Transitive",
307-
"resolved": "6.0.0",
308-
"contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==",
306+
"resolved": "6.0.1",
307+
"contentHash": "X3cTdM+jna1YyfTUzToW7aVgINFv7R1W4+1+3hua/YCyLjApPoR8fd+2Cep9DbfYjbv+rBx4K6dlmAWEJr9AHg==",
309308
"dependencies": {
310309
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
311310
"System.Text.Encodings.Web": "6.0.0"
312311
}
313312
},
314-
"System.Threading.Tasks.Extensions": {
315-
"type": "Transitive",
316-
"resolved": "4.5.4",
317-
"contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg=="
318-
},
319313
"nogic.writableoptions": {
320314
"type": "Project",
321315
"dependencies": {

0 commit comments

Comments
 (0)