Clara icon indicating copy to clipboard operation
Clara copied to clipboard

Option value can't start with a dash

Open aivarsk opened this issue 8 years ago • 1 comments

This test case fails:

TEST_CASE( "Opt value can start with a dash" ) {
    std::string name;
    bool showHelp = false;
    auto parser
            = Help( showHelp )
            | Opt( name, "name" )
                ["-n"]["--name"]
                ( "the name to use" );

    auto result = parser.parse( Args{ "TestApp", "-n", "-lfoobar" } );
    CHECK( result );
    REQUIRE( name == "-lfoobar" );
}

I have a program that receives compiler flags in arguments so a leading dash is common.

aivarsk avatar Jan 08 '18 10:01 aivarsk

Also related to this issue: if I have an option that takes an integer, it can no longer be negative, since Clara can't parse things that start this a minus.

mike239x avatar Feb 20 '19 18:02 mike239x