diff --git a/cmdopt.cpp b/cmdopt.cpp index 341161ed..08a25b91 100644 --- a/cmdopt.cpp +++ b/cmdopt.cpp @@ -162,6 +162,48 @@ present::finish (void) } +/////////////////////////////////////////////////////////////////////////////// +namespace util { namespace cmdopt { namespace option { + template <> + void + value::execute (const char *restrict str) + { + static const std::string TRUE_STRING[] = { + "true", + "yes", + "y", + "1" + }; + + if (std::any_of (std::begin (TRUE_STRING), + std::end (TRUE_STRING), + [str] (auto i) { return i == str; })) + { + m_data = true; + return; + } + + static const std::string FALSE_STRING[] = { + "false", + "no", + "n", + "0" + }; + + if (std::any_of (std::begin (FALSE_STRING), + std::end (FALSE_STRING), + [str] (auto i) { return i == str; })) + { + m_data = false; + return; + } + + base::execute (str); + seen (true); + } +} } } + + //----------------------------------------------------------------------------- namespace util { namespace cmdopt { namespace option { template class value;