tag::reference[] [#lyra_cli_parse] === `lyra::cli::parse` [source] ---- parse_result cli::parse( args const& args, const option_style& customize) const; ---- Parses given arguments `args` and optional option style. The result indicates success or failure, and if failure what kind of failure it was. The state of variables bound to options is unspecified and any bound callbacks may have been call
| 328 | |
| 329 | end::reference[] */ |
| 330 | inline parse_result cli::parse( |
| 331 | args const & args, const option_style & style) const |
| 332 | { |
| 333 | LYRA_PRINT_SCOPE("cli::parse"); |
| 334 | m_exeName.set(args.exe_name()); |
| 335 | detail::token_iterator args_tokens(args, style); |
| 336 | parse_result p_result = parse(args_tokens, style); |
| 337 | if (p_result |
| 338 | && (p_result.value().type() == parser_result_type::no_match |
| 339 | || p_result.value().type() == parser_result_type::matched |
| 340 | || p_result.value().type() == parser_result_type::empty_match)) |
| 341 | { |
| 342 | if (p_result.value().have_tokens()) |
| 343 | { |
| 344 | return parse_result::error(p_result.value(), |
| 345 | "Unrecognized token: " |
| 346 | + p_result.value().remainingTokens().argument().name); |
| 347 | } |
| 348 | } |
| 349 | return p_result; |
| 350 | } |
| 351 | |
| 352 | /* tag::reference[] |
| 353 | [#lyra_cli_style] |