boostorg / boostorg/program_options

The parsing error of the multitoken argument with negative numbers

Open
#33 6 comments 5 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
136
Forks
117
PR merge metrics
No merged PRs in 30d

Description

The parsing error of the multitoken argument with negative numbers occurs while setting negative numbers after the first number.

For example, if we set an option
```cpp
("point,p", po::value>(&options.point)->multitoken(), "The point")
```
and enter in the command line the following values
```
prog -p -1 2 3
```
It works correctly.
However, if we enter the values given bellow
```
prog -p -1 -2 3
```
the parsing error occurs
```
unrecognised option '-2'
```

This error exists in Boost 1.65.1 as well.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the shown multitoken option and both command-line examples, then trace the command-line option parsing path that classifies negative values after the first token. Done means the `-p -1 -2 3` invocation is accepted and produces the same vector as `-p -1 2 3`, with coverage for the reported regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.