mirror of
https://github.com/boostorg/program_options.git
synced 2026-01-24 18:12:37 +00:00
Really make unregistered options to work.
- Add forwarding method allow_unregistered to the basic_command_line parser class. - Add new 'collect_unrecognized' function - Add new field 'original_tokens' to the basic_option class [SVN r31490]
This commit is contained in:
@@ -248,6 +248,7 @@ namespace boost { namespace program_options { namespace detail {
|
||||
if (!ok) {
|
||||
option opt;
|
||||
opt.value.push_back(args[0]);
|
||||
opt.original_tokens.push_back(args[0]);
|
||||
result.push_back(opt);
|
||||
args.erase(args.begin());
|
||||
}
|
||||
@@ -331,6 +332,7 @@ namespace boost { namespace program_options { namespace detail {
|
||||
// Everything's OK, move the values to the result.
|
||||
for(;!other_tokens.empty() && max_tokens--; ) {
|
||||
opt.value.push_back(other_tokens[0]);
|
||||
opt.original_tokens.push_back(other_tokens[0]);
|
||||
other_tokens.erase(other_tokens.begin());
|
||||
}
|
||||
}
|
||||
@@ -368,6 +370,7 @@ namespace boost { namespace program_options { namespace detail {
|
||||
opt.string_key = name;
|
||||
if (!adjacent.empty())
|
||||
opt.value.push_back(adjacent);
|
||||
opt.original_tokens.push_back(tok);
|
||||
result.push_back(opt);
|
||||
args.erase(args.begin());
|
||||
}
|
||||
@@ -416,6 +419,7 @@ namespace boost { namespace program_options { namespace detail {
|
||||
|
||||
option opt;
|
||||
opt.string_key = name;
|
||||
opt.original_tokens.push_back(tok);
|
||||
if (!adjacent.empty())
|
||||
opt.value.push_back(adjacent);
|
||||
result.push_back(opt);
|
||||
@@ -442,6 +446,7 @@ namespace boost { namespace program_options { namespace detail {
|
||||
opt.string_key = name;
|
||||
if (!adjacent.empty())
|
||||
opt.value.push_back(adjacent);
|
||||
opt.original_tokens.push_back(tok);
|
||||
result.push_back(opt);
|
||||
args.erase(args.begin());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user