boostorg / boostorg/program_options

Long option name tokens are parsed as previous option value

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

Description

https://github.com/boostorg/program_options/blob/d95d31684832075fda04c9fc916f8ec875552763/src/cmdline.cpp#L477

If long option follows an option with (string) value, it is parsed as value instead of known option. For example in command line "--option_with_value --known_option", option_with_value will have value equal to "--known_option". This issue does not occur if following option is in short format.

As I understand the code, find_nothrow in referenced file is given token with leading dashes instead of option's string_key (or name).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/cmdline.cpp around line 477 and reproduce the command line containing --option_with_value --known_option. Trace how the token is passed to find_nothrow and verify that the known long option is recognized instead of consumed as the previous string option's value; add coverage for the long-option case and confirm the existing short-option behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.