Boost :: program_options - does it exactly match strings for command line options?

The problem seems to be related to how boost :: program_options options_description is executed.

int main(int argc, char* argv[])
{
    boost::program_options::options_description desc("CmdLine utility");
    desc.add_options()
        ("hel", "hel message")
        ("help", "produce help message")
        ("helps","helps message")       
    ;
    boost::program_options::variables_map vm;
    boost::program_options::store(boost::program_options::parse_command_line(argc, argv,desc), vm);
    boost::program_options::notify(vm);

    if(vm.count("help")) {
        std::cout << desc << std::endl;
    }
    if(vm.count("helps")) {
        std::cout << "helps..." << std::endl;
    }
    if(vm.count("hel")) {
        std::cout << "hel..." << std::endl;
    }
    return 0;
}

Output -

C:\code>cmd.exe --helps
helps...
C:\code>cmd.exe --help
helps...
C:\code>cmd.exe --hel
helps...

The output changes if I change the order of adding options using a call add_options(). It also looks like program_options does not execute the full command line, so even if you enter a substring of the parameter, it will treat it as valid without doing a full string comparison. If this is a boost :: program_options function, is there a way to get it to perform exact string matching rather than doing it with a substring? (I am using Boost version 1.42)

+3
2

program_option allow_guessing, . , , , , , . 1.45.

+3

, . , , . , :

[vladimir@asa example]$ ./a.out --help
CmdLine utility:
  --hel                 hel message
  --help                produce help message
  --helps               helps message

[vladimir@asa example]$ ./a.out --hel
hel...
[vladimir@asa example]$ ./a.out --helps
helps...
0

Source: https://habr.com/ru/post/1775255/