boostorg / boostorg/program_options

The parsing error of the multitoken argument with negative numbers

Offen
#33 6 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
136
Forks
117
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
cli
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
40/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.