|
8 | 8 | using Rocket.Surgery.Conventions;
|
9 | 9 | using Rocket.Surgery.Hosting;
|
10 | 10 |
|
| 11 | +using Sample.Command; |
| 12 | + |
11 | 13 | using Spectre.Console.Cli;
|
12 | 14 |
|
13 | 15 | var builder = Host.CreateApplicationBuilder(args);
|
|
28 | 30 | );
|
29 | 31 | await host.RunAsync();
|
30 | 32 |
|
31 |
| -public class InstanceThing |
| 33 | +namespace Sample.Command |
32 | 34 | {
|
33 |
| - public string From => "DryIoc"; |
34 |
| -} |
| 35 | + public class InstanceThing |
| 36 | + { |
| 37 | + public string From => "DryIoc"; |
| 38 | + } |
35 | 39 |
|
36 |
| -public class Dump(IConfiguration configuration, ILogger<Dump> logger, InstanceThing instanceThing) |
37 |
| - : Command<AppSettings> |
38 |
| -{ |
39 |
| - public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings) |
| 40 | + public class Dump(IConfiguration configuration, ILogger<Dump> logger, InstanceThing instanceThing) |
| 41 | + : Command<AppSettings> |
40 | 42 | {
|
41 |
| - // ReSharper disable once TemplateIsNotCompileTimeConstantProblem |
42 |
| - logger.LogInformation(instanceThing.From); |
43 |
| - foreach (var item in configuration.AsEnumerable().Reverse()) |
| 43 | + public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings) |
44 | 44 | {
|
45 |
| - logger.LogInformation("{Key}: {Value}", item.Key, item.Value ?? ""); |
46 |
| - } |
| 45 | + // ReSharper disable once TemplateIsNotCompileTimeConstantProblem |
| 46 | + logger.LogInformation(instanceThing.From); |
| 47 | + foreach (var item in configuration.AsEnumerable().Reverse()) |
| 48 | + { |
| 49 | + logger.LogInformation("{Key}: {Value}", item.Key, item.Value ?? ""); |
| 50 | + } |
47 | 51 |
|
48 |
| - return 1; |
| 52 | + return 1; |
| 53 | + } |
49 | 54 | }
|
50 |
| -} |
51 | 55 |
|
52 |
| -public class DefaultCommand(ILogger<DefaultCommand> logger) : Command<AppSettings> |
53 |
| -{ |
54 |
| - public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings) |
| 56 | + public class DefaultCommand(ILogger<DefaultCommand> logger) : Command<AppSettings> |
55 | 57 | {
|
56 |
| - Console.WriteLine("Hello World!"); |
57 |
| - logger.LogInformation("Test"); |
58 |
| - return 1; |
| 58 | + public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings) |
| 59 | + { |
| 60 | + Console.WriteLine("Hello World!"); |
| 61 | + logger.LogInformation("Test"); |
| 62 | + return 1; |
| 63 | + } |
59 | 64 | }
|
60 | 65 | }
|
0 commit comments