Issue 19335 - std.getopt: make it an error to have options that differ only by case when case insensitive
Summary: std.getopt: make it an error to have options that differ only by case when ca...
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-26 04:32 UTC by Neia Neutuladh
Modified: 2024-12-01 16:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Neia Neutuladh 2018-10-26 04:32:17 UTC
void main(string[] args)
{
    import std.getopt;
    import std.stdio;
    int a, A;
    getopt(args, "a", &a, "A", &A);
    writefln("a=%s, A=%s", a, A);
}

Compile, run with `-a 5 -A 10`.

The expected result is an exception saying that option `A|a` is multiply defined, hopefully also mentioning that the case-sensitive flag exists.

The actual result is that `a` is set twice and `A` is not set.

This exception should also trigger when you define an argument named `H`.

(I would also argue that case-insensitive is a terrible default, but that's unlikely to change.)
Comment 1 dlangBugzillaToGithub 2024-12-01 16:34:22 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10355

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB