From ec9e62c2c8a892fb21e73733a29b272624058c23 Mon Sep 17 00:00:00 2001 From: Masashi Fujita Date: Mon, 4 Dec 2017 16:15:20 +0900 Subject: [PATCH] =?UTF-8?q?`|`=20should=20be=20inside=20of=20`(=E2=80=A6)`?= =?UTF-8?q?=20(#87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * `|` should be inside of `(…)` It's possible to use `(t|true|T|True)` as `truthy_pattern` but still failing `true` as a truthy under my environment :-( ``` Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ``` --- include/cxxopts.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 49ade40..184de72 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -444,9 +444,9 @@ namespace cxxopts std::basic_regex integer_pattern ("(-)?(0x)?([1-9a-zA-Z][0-9a-zA-Z]*)|((0x)?0)"); std::basic_regex truthy_pattern - ("t|true|T|True"); + ("(t|T)(rue)?"); std::basic_regex falsy_pattern - ("(f|false|F|False)?"); + ("((f|F)(alse)?)?"); } namespace detail @@ -1570,7 +1570,7 @@ ParseResult::consume_positional(std::string a) if (iter != m_options.end()) { auto& result = m_results[iter->second]; - if (!iter->second->value().is_container()) + if (!iter->second->value().is_container()) { if (result.count() == 0) {