Jump to page: 1 2
Thread overview
[Issue 15914] [REG 2.071] getopt doesn't accept anymore a character for a bool option
[Issue 15914] getopt, the new option validator doesn't accept a character for a bool option
Apr 12, 2016
Vladimir Panteleev
Apr 12, 2016
b2.temp@gmx.com
Apr 12, 2016
b2.temp@gmx.com
Apr 12, 2016
b2.temp@gmx.com
Apr 12, 2016
b2.temp@gmx.com
Apr 12, 2016
Vladimir Panteleev
Apr 12, 2016
Vladimir Panteleev
Apr 12, 2016
Vladimir Panteleev
Apr 12, 2016
b2.temp@gmx.com
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Please provide a minimum self-contained example.

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|getopt, the new option      |[REG 2.071] getopt doesn't
                   |validator doesn't accept a  |accept anymore a character
                   |character for a bool option |for a bool option

--- Comment #2 from b2.temp@gmx.com ---
Actually even if the option validator is commented, the following test is not compiled


unittest
{
    bool opt;
    string args;
    getopt(args, config.passThrough 'a', &opt);
}�


so the problem comes from somewhere else.

There's nothing in the file history that explicitly remove this feature between 2.070 and 2.071.

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #3 from b2.temp@gmx.com ---
Actually even if the option validator is commented, the following test is not compiled


unittest
{
    bool opt;
    string args;
    getopt(args, config.passThrough 'a', &opt);
}�


so the problem comes from somewhere else.

There's nothing in the file history that explicitly remove this feature between 2.070 and 2.071.

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #4 from b2.temp@gmx.com ---
(In reply to b2.temp from comment #3)
> Actually even if the option validator is commented, the following test is not compiled

somment line 626:

static assert(validationMessage == "", validationMessage);
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #5 from b2.temp@gmx.com ---
I meant "comment" the line

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #6 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to b2.temp from comment #3)
> unittest
> {
>     bool opt;
>     string args;
>     getopt(args, config.passThrough 'a', &opt);
> }

This example never worked.

Even after you add the missing comma and delete the strange character at the end.

Please post an actual complete program that can be copied and pasted into a .d file which will compile with an older version but not a newer one.

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Figured it out. Complete example:

//////////////////// test.d ////////////////////
import std.getopt;

void main()
{
    bool opt;
    string[] args;
    getopt(args, config.passThrough, 'a', &opt);
}
////////////////////////////////////////////////

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #8 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Introduced in https://github.com/D-Programming-Language/phobos/pull/3859

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

--- Comment #9 from github-bugzilla@puremagic.com ---
Commit pushed to revert-3859-getopt-checker at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/cedfb8c153b910e2d9e82112b2cbe519cd870491 std.getopt: Add unit test for issue 15914

--
April 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15914

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #10 from b2.temp@gmx.com ---
If you land here because you're affected by the regression a simple fix consist into replacing the character by a string.

getOpt(args, "a", &a)

A fix is prepared for the next release.

--
« First   ‹ Prev
1 2