Skip to content

Fix --key= empty string value consuming next arg in std.getopt#11008

Merged
thewilsonator merged 1 commit intodlang:masterfrom
burner:issue_10791_getopt_empty_value
May 6, 2026
Merged

Fix --key= empty string value consuming next arg in std.getopt#11008
thewilsonator merged 1 commit intodlang:masterfrom
burner:issue_10791_getopt_empty_value

Conversation

@burner
Copy link
Copy Markdown
Member

@burner burner commented May 5, 2026

Fixes #10791

Comment thread std/getopt.d
(is(R == delegate) || is(Target == function)) &&
!is(typeof(receiver("", "")));
if (!isCallbackWithLessThanTwoParameters && !(val.length) && !incremental)
if (!isCallbackWithLessThanTwoParameters && val is null && !incremental)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this breaks a unittest (at line 1036), presumably either it needs updating or we need to check for both val is null && !(val.length)

@burner burner force-pushed the issue_10791_getopt_empty_value branch from 598e93e to da2bc7f Compare May 6, 2026 09:32
@thewilsonator thewilsonator merged commit d32896a into dlang:master May 6, 2026
9 of 10 checks passed
@kinke
Copy link
Copy Markdown
Contributor

kinke commented May 6, 2026

Thanks!

@burner
Copy link
Copy Markdown
Member Author

burner commented May 6, 2026

@thewilsonator thank you

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.

std.getopt: No support for empty string values with --key=value syntax

3 participants