Skip to content

Commit 936ca0d

Browse files
committed
compilable
1 parent fa906e5 commit 936ca0d

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/ConsoleAppFramework/Parser.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,8 @@ public GlobalOptionInfo[] ParseGlobalOptions()
222222
bool isRequired = x.required;
223223
object? defaultValue = null;
224224

225-
// TODO: need
226-
if (memberAccess.Name is GenericNameSyntax genericName)
227-
{
228-
var typeArgument = genericName.TypeArgumentList.Arguments[0];
229-
typeSymbol = new(model.GetTypeInfo(typeArgument).Type!); // TODO: not !
230-
}
225+
var symbolInfo = model.GetSymbolInfo(memberAccess).Symbol as IMethodSymbol;
226+
typeSymbol = new(symbolInfo!.TypeArguments[0]);
231227

232228
var arguments = node.ArgumentList.Arguments;
233229
name = model.GetConstantValue(arguments[0].Expression).Value!.ToString();

tests/ConsoleAppFramework.GeneratorTests/GlobalOptionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void EnumParse()
6868
app.ConfigureGlobalOptions((ref ConsoleApp.GlobalOptionsBuilder builder) =>
6969
{
7070
var p = builder.AddGlobalOption("--parameter", "", 0);
71-
var d = builder.AddGlobalOption("--dry-run", "");
71+
var d = builder.AddGlobalOption<bool>("--dry-run", "");
7272
var f = builder.AddGlobalOption("--fruit", "", Fruit.Orange);
7373
return (p, d, f);
7474
});

0 commit comments

Comments
 (0)