Bug 20819 – std.getopt should detect duplicated pointers passed as arguments.

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-05-11T04:03:07Z
Last change time
2024-12-01T16:36:46Z
Assigned to
No Owner
Creator
Witold Baryluk
Moved to GitHub: phobos#9794 →

Comments

Comment #0 by witold.baryluk+d — 2020-05-11T04:03:07Z
import std.getop; auto optparser = getopt( args, std.getopt.config.passThrough, std.getopt.config.caseSensitive, ...., "iterations_min", "A iterations minimum (default: " ~ to!string(iterations_min) ~ ")", &iterations_min, "iterations_max", "A iterations maximum (default: " ~ to!string(iterations_max) ~ ")", &iterations_min, ); Spot the error. It should be detected by the getopt automatically and throw an exception without even checking the 'args'. I really doubt there is a valid use case to have duplicated pointers, and if there is (i.e. renaming flags and deprecating but supporting old one), it can be enabled using std.getopt.config flag.
Comment #1 by robert.schadek — 2024-12-01T16:36:46Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9794 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB