The parsing error of the multitoken argument with negative numbers

Open
#33 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

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

("point,p", po::value<std::vector<float>>(&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.

Dominant language
C++
Stars
136
Forks
117
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/program_options

All issues in boostorg/program_options

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.