|
12 | 12 | var app = ConsoleApp.Create(); |
13 | 13 |
|
14 | 14 | // parse immediately |
15 | | -var verbose = app.AddGlobalOptions<bool>(ref args, "-v|--verbose"); |
16 | | -var noColor = app.AddGlobalOptions<bool>(ref args, "--no-color", "Don't colorize output."); |
17 | | -var dryRun = app.AddGlobalOptions<bool>(ref args, "--dry-run"); |
18 | | -var prefixOutput = app.AddRequiredGlobalOptions<string>(ref args, "--prefix-output", "Prefix output with level."); |
| 15 | +var verbose = app.AddGlobalOption<bool>(ref args, "-v|--verbose"); |
| 16 | +var noColor = app.AddGlobalOption<bool>(ref args, "--no-color", "Don't colorize output."); |
| 17 | +var dryRun = app.AddGlobalOption<bool>(ref args, "--dry-run"); |
| 18 | +var prefixOutput = app.AddRequiredGlobalOption<string>(ref args, "--prefix-output", "Prefix output with level."); |
19 | 19 |
|
20 | 20 | app.ConfigureServices(x => |
21 | 21 | { |
@@ -62,13 +62,13 @@ internal static partial class ConsoleApp |
62 | 62 | { |
63 | 63 | internal partial class ConsoleAppBuilder |
64 | 64 | { |
65 | | - public T AddGlobalOptions<T>(ref string[] args, string name, string description = "", T defaultValue = default(T)) |
| 65 | + public T AddGlobalOption<T>(ref string[] args, string name, string description = "", T defaultValue = default(T)) |
66 | 66 | where T : IParsable<T> |
67 | 67 | { |
68 | 68 | return default(T); |
69 | 69 | } |
70 | 70 |
|
71 | | - public T AddRequiredGlobalOptions<T>(ref string[] args, [ConstantExpected] string name, [ConstantExpected] string description = "") |
| 71 | + public T AddRequiredGlobalOption<T>(ref string[] args, [ConstantExpected] string name, [ConstantExpected] string description = "") |
72 | 72 | where T : IParsable<T> |
73 | 73 | { |
74 | 74 | if (typeof(T) == typeof(bool)) throw new ArgumentException(); |
|
0 commit comments