| 1711 | }; |
| 1712 | |
| 1713 | class Options |
| 1714 | { |
| 1715 | public: |
| 1716 | |
| 1717 | explicit Options(std::string program, std::string help_string = "") |
| 1718 | : m_program(std::move(program)) |
| 1719 | , m_help_string(toLocalString(std::move(help_string))) |
| 1720 | , m_custom_help("[OPTION...]") |
| 1721 | , m_positional_help("positional parameters") |
| 1722 | , m_show_positional(false) |
| 1723 | , m_allow_unrecognised(false) |
| 1724 | , m_width(76) |
| 1725 | , m_tab_expansion(false) |
| 1726 | , m_options(std::make_shared<OptionMap>()) |
| 1727 | { |
| 1728 | } |
| 1729 | |
| 1730 | Options& |
| 1731 | positional_help(std::string help_text) |
| 1732 | { |
| 1733 | m_positional_help = std::move(help_text); |
| 1734 | return *this; |
| 1735 | } |
| 1736 | |
| 1737 | Options& |
| 1738 | custom_help(std::string help_text) |
| 1739 | { |
| 1740 | m_custom_help = std::move(help_text); |
| 1741 | return *this; |
| 1742 | } |
| 1743 | |
| 1744 | Options& |
| 1745 | show_positional_help() |
| 1746 | { |
| 1747 | m_show_positional = true; |
| 1748 | return *this; |
| 1749 | } |
| 1750 | |
| 1751 | Options& |
| 1752 | allow_unrecognised_options() |
| 1753 | { |
| 1754 | m_allow_unrecognised = true; |
| 1755 | return *this; |
| 1756 | } |
| 1757 | |
| 1758 | Options& |
| 1759 | set_width(size_t width) |
| 1760 | { |
| 1761 | m_width = width; |
| 1762 | return *this; |
| 1763 | } |
| 1764 | |
| 1765 | Options& |
| 1766 | set_tab_expansion(bool expansion=true) |
| 1767 | { |
| 1768 | m_tab_expansion = expansion; |
| 1769 | return *this; |
| 1770 | } |
nothing calls this directly
no outgoing calls
no test coverage detected