mirror of
				https://github.com/Tyrrrz/CliFx.git
				synced 2025-10-25 15:19:17 +00:00 
			
		
		
		
	C#10ify
This commit is contained in:
		| @@ -3,22 +3,21 @@ using System.Threading.Tasks; | ||||
| using CliFx.Attributes; | ||||
| using CliFx.Infrastructure; | ||||
|  | ||||
| namespace CliFx.Tests.Dummy.Commands | ||||
| namespace CliFx.Tests.Dummy.Commands; | ||||
|  | ||||
| [Command("console-test")] | ||||
| public class ConsoleTestCommand : ICommand | ||||
| { | ||||
|     [Command("console-test")] | ||||
|     public class ConsoleTestCommand : ICommand | ||||
|     public ValueTask ExecuteAsync(IConsole console) | ||||
|     { | ||||
|         public ValueTask ExecuteAsync(IConsole console) | ||||
|         var input = console.Input.ReadToEnd(); | ||||
|  | ||||
|         using (console.WithColors(ConsoleColor.Black, ConsoleColor.White)) | ||||
|         { | ||||
|             var input = console.Input.ReadToEnd(); | ||||
|  | ||||
|             using (console.WithColors(ConsoleColor.Black, ConsoleColor.White)) | ||||
|             { | ||||
|                 console.Output.WriteLine(input); | ||||
|                 console.Error.WriteLine(input); | ||||
|             } | ||||
|  | ||||
|             return default; | ||||
|             console.Output.WriteLine(input); | ||||
|             console.Error.WriteLine(input); | ||||
|         } | ||||
|  | ||||
|         return default; | ||||
|     } | ||||
| } | ||||
| @@ -2,19 +2,18 @@ | ||||
| using CliFx.Attributes; | ||||
| using CliFx.Infrastructure; | ||||
|  | ||||
| namespace CliFx.Tests.Dummy.Commands | ||||
| namespace CliFx.Tests.Dummy.Commands; | ||||
|  | ||||
| [Command("env-test")] | ||||
| public class EnvironmentTestCommand : ICommand | ||||
| { | ||||
|     [Command("env-test")] | ||||
|     public class EnvironmentTestCommand : ICommand | ||||
|     [CommandOption("target", EnvironmentVariable = "ENV_TARGET")] | ||||
|     public string GreetingTarget { get; set; } = "World"; | ||||
|  | ||||
|     public ValueTask ExecuteAsync(IConsole console) | ||||
|     { | ||||
|         [CommandOption("target", EnvironmentVariable = "ENV_TARGET")] | ||||
|         public string GreetingTarget { get; set; } = "World"; | ||||
|         console.Output.WriteLine($"Hello {GreetingTarget}!"); | ||||
|  | ||||
|         public ValueTask ExecuteAsync(IConsole console) | ||||
|         { | ||||
|             console.Output.WriteLine($"Hello {GreetingTarget}!"); | ||||
|  | ||||
|             return default; | ||||
|         } | ||||
|         return default; | ||||
|     } | ||||
| } | ||||
| @@ -1,24 +1,22 @@ | ||||
| using System.Reflection; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace CliFx.Tests.Dummy | ||||
| namespace CliFx.Tests.Dummy; | ||||
| // This dummy application is used in tests for scenarios | ||||
| // that require an external process to properly verify. | ||||
|  | ||||
| public static partial class Program | ||||
| { | ||||
|     // This dummy application is used in tests for scenarios | ||||
|     // that require an external process to properly verify. | ||||
|     public static Assembly Assembly { get; } = typeof(Program).Assembly; | ||||
|  | ||||
|     public static partial class Program | ||||
|     { | ||||
|         public static Assembly Assembly { get; } = typeof(Program).Assembly; | ||||
|     public static string Location { get; } = Assembly.Location; | ||||
| } | ||||
|  | ||||
|         public static string Location { get; } = Assembly.Location; | ||||
|     } | ||||
|  | ||||
|     public static partial class Program | ||||
|     { | ||||
|         public static async Task Main() => | ||||
|             await new CliApplicationBuilder() | ||||
|                 .AddCommandsFromThisAssembly() | ||||
|                 .Build() | ||||
|                 .RunAsync(); | ||||
|     } | ||||
| public static partial class Program | ||||
| { | ||||
|     public static async Task Main() => | ||||
|         await new CliApplicationBuilder() | ||||
|             .AddCommandsFromThisAssembly() | ||||
|             .Build() | ||||
|             .RunAsync(); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user