Skip to content

Conversation

@gewarren
Copy link
Contributor

Comment on lines 30 to 33
/// <summary>
/// The token that was parsed to specify the directive.
/// Gets the token that was parsed to specify the directive.
/// </summary>
public Token Token { get; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unclear in the case where the command line has multiple directive tokens with the same name: [name] [name:value1] [name:value2]. IIRC the library parses those and collects all of them to the same DirectiveResult instance, whose Values property then is { "name1", "name2" } (not sure whether the null value is just lost entirely). But which token do you get in the Token property then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolving to merge since I don't know the answer. I will unresolve after merge.

Copy link
Contributor

@jonsequitur jonsequitur Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the library parses those and collects all of them to the same DirectiveResult instance, whose Values property then is { "name1", "name2" }

This is correct.

(not sure whether the null value is just lost entirely). But which token do you get in the Token property then?

This is a bit of a rough edge, and there's a bug. I wrote a quick test to explore this.

  • There's no null value in the Values property (which I think is reasonable but I could see an argument for it either way).
  • The Token property contains the first instance of the directive and the Tokens property contains the others. This seems like a bug.

@gewarren
Copy link
Contributor Author

@adamsitnik Could you review?

@gewarren
Copy link
Contributor Author

Can someone from the team comment on the outstanding questions so I can move forward with this PR?

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @gewarren !

@gewarren
Copy link
Contributor Author

@jonsequitur Could you merge it please? I don't have perms.

@adamsitnik adamsitnik merged commit 11d8ba2 into dotnet:main Nov 18, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants