| 659 | } |
| 660 | |
| 661 | DOCOPT_INLINE |
| 662 | docopt::Options |
| 663 | docopt::docopt(std::string const& doc, |
| 664 | std::vector<std::string> const& argv, |
| 665 | bool help, |
| 666 | std::string const& version, |
| 667 | bool options_first) noexcept |
| 668 | { |
| 669 | try { |
| 670 | return docopt_parse(doc, argv, help, !version.empty(), options_first); |
| 671 | } catch (DocoptExitHelp const&) { |
| 672 | std::cout << doc << std::endl; |
| 673 | std::exit(0); |
| 674 | } catch (DocoptExitVersion const&) { |
| 675 | std::cout << version << std::endl; |
| 676 | std::exit(0); |
| 677 | } catch (DocoptLanguageError const& error) { |
| 678 | std::cerr << "Docopt usage string could not be parsed" << std::endl; |
| 679 | std::cerr << error.what() << std::endl; |
| 680 | std::exit(-1); |
| 681 | } catch (DocoptArgumentError const& error) { |
| 682 | std::cerr << error.what(); |
| 683 | std::cout << std::endl; |
| 684 | std::cout << doc << std::endl; |
| 685 | std::exit(-1); |
| 686 | } /* Any other exception is unexpected: let std::terminate grab it */ |
| 687 | } |
nothing calls this directly
no outgoing calls
no test coverage detected