Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cxxopts for openSUSE:Factory checked 
in at 2025-07-11 21:29:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cxxopts (Old)
 and      /work/SRC/openSUSE:Factory/.cxxopts.new.7373 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cxxopts"

Fri Jul 11 21:29:29 2025 rev:6 rq:1291779 version:3.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/cxxopts/cxxopts.changes  2025-05-26 
18:36:52.682806302 +0200
+++ /work/SRC/openSUSE:Factory/.cxxopts.new.7373/cxxopts.changes        
2025-07-11 21:31:11.939737527 +0200
@@ -1,0 +2,15 @@
+Tue Jul  1 06:07:59 UTC 2025 - Jiri Slaby <jsl...@suse.cz>
+
+- fix build with gcc 15 ("Added missing header" below)
+- update to 3.3.1:
+  * Added missing version bump
+  * Added missing header for GCC 15
+  * Fix some CMake packaging problems
+  * `as_optional`
+  * `ParseResult::contains`
+  * `std::filesystem` support
+  * CMake 4 compatibility
+- remove (is upstream):
+  cxxopts-3.2.1-cmake4.patch
+
+-------------------------------------------------------------------

Old:
----
  cxxopts-3.2.1-cmake4.patch
  cxxopts-3.2.1.tar.gz

New:
----
  cxxopts-3.3.1.tar.gz

----------(Old B)----------
  Old:- remove (is upstream):
  cxxopts-3.2.1-cmake4.patch
----------(Old E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cxxopts.spec ++++++
--- /var/tmp/diff_new_pack.D516I4/_old  2025-07-11 21:31:12.363755011 +0200
+++ /var/tmp/diff_new_pack.D516I4/_new  2025-07-11 21:31:12.367755176 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package cxxopts
 #
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
 # Copyright (c) 2025 Andreas Stieger <andreas.stie...@gmx.de>
 #
 # All modifications and additions to the file contributed by third parties
@@ -18,13 +18,12 @@
 
 
 Name:           cxxopts
-Version:        3.2.1
+Version:        3.3.1
 Release:        0
 Summary:        C++ command line option parser
 License:        MIT
 URL:            https://github.com/jarro2783/cxxopts
 Source0:        
https://github.com/jarro2783/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
-Patch0:         cxxopts-3.2.1-cmake4.patch
 BuildRequires:  c++_compiler
 BuildRequires:  cmake
 
@@ -48,7 +47,7 @@
 
 %build
 %cmake \
-   -DCXXOPTS_BUILD_EXAMPLES:BOOL=oFF \
+   -DCXXOPTS_BUILD_EXAMPLES:BOOL=OFF \
    -DCXXOPTS_BUILD_TESTS:BOOL=ON
 %cmake_build
 
@@ -62,6 +61,6 @@
 %doc README.md
 %license LICENSE
 %{_includedir}/%{name}.hpp
-%{_libdir}/cmake/%{name}/
-%{_libdir}/pkgconfig/%{name}.pc
+%{_datadir}/cmake/%{name}/
+%{_datadir}/pkgconfig/%{name}.pc
 

++++++ cxxopts-3.2.1.tar.gz -> cxxopts-3.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/CHANGELOG.md 
new/cxxopts-3.3.1/CHANGELOG.md
--- old/cxxopts-3.2.1/CHANGELOG.md      2024-02-20 09:39:52.000000000 +0100
+++ new/cxxopts-3.3.1/CHANGELOG.md      2025-05-26 10:09:26.000000000 +0200
@@ -3,6 +3,26 @@
 This is the changelog for `cxxopts`, a C++11 library for parsing command line
 options. The project adheres to semantic versioning.
 
+## 3.3.1
+
+### Bug fixes
+
+* Added missing version bump
+
+## 3.3.0
+
+### Bug fixes
+
+* Added missing header for GCC 15
+* Fix some CMake packaging problems
+
+### Added
+
+* `as_optional`
+* `ParseResult::contains`
+* `std::filesystem` support
+* CMake 4 compatibility
+
 ## 3.2.1
 
 ### Bug fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/CMakeLists.txt 
new/cxxopts-3.3.1/CMakeLists.txt
--- old/cxxopts-3.2.1/CMakeLists.txt    2024-02-20 09:39:52.000000000 +0100
+++ new/cxxopts-3.3.1/CMakeLists.txt    2025-05-26 10:09:26.000000000 +0200
@@ -17,12 +17,10 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
-cmake_minimum_required(VERSION 3.1...3.19)
+cmake_minimum_required(VERSION 3.5...3.19)
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
 include(cxxopts)
-set("PROJECT_DESCRIPTION" "A header-only lightweight C++ command line option 
parser")
-set("PROJECT_HOMEPAGE_URL" "https://github.com/jarro2783/cxxopts";)
 
 # Get the version of the library
 cxxopts_getversion(VERSION)
@@ -32,6 +30,9 @@
     LANGUAGES CXX
 )
 
+set("PROJECT_DESCRIPTION" "A header-only lightweight C++ command line option 
parser")
+set("PROJECT_HOMEPAGE_URL" "https://github.com/jarro2783/cxxopts";)
+
 # Must include after the project call due to GNUInstallDirs requiring a 
language be enabled (IE. CXX)
 include(GNUInstallDirs)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/cmake/cxxopts.cmake 
new/cxxopts-3.3.1/cmake/cxxopts.cmake
--- old/cxxopts-3.2.1/cmake/cxxopts.cmake       2024-02-20 09:39:52.000000000 
+0100
+++ new/cxxopts-3.3.1/cmake/cxxopts.cmake       2025-05-26 10:09:26.000000000 
+0200
@@ -87,10 +87,17 @@
 
 # Helper function to ecapsulate install logic
 function(cxxopts_install_logic)
-    if(CMAKE_LIBRARY_ARCHITECTURE)
-        string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" 
CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
+    if(NOT CXXOPTS_USE_UNICODE_HELP)
+        if(CMAKE_LIBRARY_ARCHITECTURE)
+            string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" 
CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
+        else()
+            # On some systems (e.g. NixOS), `CMAKE_LIBRARY_ARCHITECTURE` can 
be empty
+            set(CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_DATAROOTDIR}")
+        endif()
+        if(${CMAKE_VERSION} VERSION_GREATER "3.14")
+            set(OPTIONAL_ARCH_INDEPENDENT "ARCH_INDEPENDENT")
+        endif()
     else()
-        # On some systems (e.g. NixOS), `CMAKE_LIBRARY_ARCHITECTURE` can be 
empty
         set(CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
     endif()
     set(CXXOPTS_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/cxxopts" 
CACHE STRING "Installation directory for cmake files, relative to 
${CMAKE_INSTALL_PREFIX}.")
@@ -99,11 +106,6 @@
     set(targets_export_name cxxopts-targets)
     set(PackagingTemplatesDir "${PROJECT_SOURCE_DIR}/packaging")
 
-
-    if(${CMAKE_VERSION} VERSION_GREATER "3.14")
-        set(OPTIONAL_ARCH_INDEPENDENT "ARCH_INDEPENDENT")
-    endif()
-
     # Generate the version, config and target files into the build directory.
     write_basic_package_version_file(
         ${version_config}
@@ -154,6 +156,10 @@
     set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")
 
     set(PKG_CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
+    if(CXXOPTS_USE_UNICODE_HELP)
+        set(PKG_CONFIG_REQUIRES "icu-cu")
+        set(PKG_CONFIG_EXTRA_CFLAGS "-DCXXOPTS_USE_UNICODE")
+    endif()
     configure_file("${PackagingTemplatesDir}/pkgconfig.pc.in" 
"${PKG_CONFIG_FILE_NAME}" @ONLY)
     install(FILES "${PKG_CONFIG_FILE_NAME}"
             DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/include/cxxopts.hpp 
new/cxxopts-3.3.1/include/cxxopts.hpp
--- old/cxxopts-3.2.1/include/cxxopts.hpp       2024-02-20 09:39:52.000000000 
+0100
+++ new/cxxopts-3.3.1/include/cxxopts.hpp       2025-05-26 10:09:26.000000000 
+0200
@@ -27,6 +27,7 @@
 #ifndef CXXOPTS_HPP_INCLUDED
 #define CXXOPTS_HPP_INCLUDED
 
+#include <cstdint>
 #include <cstdlib>
 #include <cstring>
 #include <exception>
@@ -72,6 +73,12 @@
 #      define CXXOPTS_HAS_OPTIONAL
 #    endif
 #  endif
+#  if __has_include(<filesystem>)
+#    include <filesystem>
+#    ifdef __cpp_lib_filesystem
+#      define CXXOPTS_HAS_FILESYSTEM
+#    endif
+#  endif
 #endif
 
 #define CXXOPTS_FALLTHROUGH
@@ -93,7 +100,7 @@
 #endif
 
 #define CXXOPTS__VERSION_MAJOR 3
-#define CXXOPTS__VERSION_MINOR 2
+#define CXXOPTS__VERSION_MINOR 3
 #define CXXOPTS__VERSION_PATCH 1
 
 #if (__GNUC__ < 10 || (__GNUC__ == 10 && __GNUC_MINOR__ < 1)) && __GNUC__ >= 6
@@ -976,11 +983,11 @@
     US limit = 0;
     if (negative)
     {
-      limit = 
static_cast<US>(std::abs(static_cast<intmax_t>(std::numeric_limits<T>::min())));
+      limit = 
static_cast<US>(std::abs(static_cast<intmax_t>((std::numeric_limits<T>::min)())));
     }
     else
     {
-      limit = std::numeric_limits<T>::max();
+      limit = (std::numeric_limits<T>::max)();
     }
 
     if (base != 0 && result > limit / base)
@@ -1073,6 +1080,15 @@
 }
 #endif
 
+#ifdef CXXOPTS_HAS_FILESYSTEM
+inline
+void
+parse_value(const std::string& text, std::filesystem::path& value)
+{
+  value.assign(text);
+}
+#endif
+
 inline
 void parse_value(const std::string& text, char& c)
 {
@@ -1538,6 +1554,18 @@
     return CXXOPTS_RTTI_CAST<const values::standard_value<T>&>(*m_value).get();
   }
 
+#ifdef CXXOPTS_HAS_OPTIONAL
+  template <typename T>
+  std::optional<T>
+  as_optional() const
+  {
+    if (m_value == nullptr) {
+      return std::nullopt;
+    }
+    return as<T>();
+  }
+#endif
+
   private:
   void
   ensure_value(const std::shared_ptr<const OptionDetails>& details)
@@ -1730,6 +1758,12 @@
     return viter->second.count();
   }
 
+  bool
+  contains(const std::string& o) const
+  {
+    return static_cast<bool>(count(o));
+  }
+
   const OptionValue&
   operator[](const std::string& option) const
   {
@@ -1750,6 +1784,24 @@
     return viter->second;
   }
 
+#ifdef CXXOPTS_HAS_OPTIONAL
+  template <typename T>
+  std::optional<T>
+  as_optional(const std::string& option) const
+  {
+    auto iter = m_keys.find(option);
+    if (iter != m_keys.end())
+    {
+      auto viter = m_values.find(iter->second);
+      if (viter != m_values.end())
+      {
+        return viter->second.as_optional<T>();
+      }
+    }
+    return std::nullopt;
+  }
+#endif
+
   const std::vector<KeyValue>&
   arguments() const
   {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/packaging/pkgconfig.pc.in 
new/cxxopts-3.3.1/packaging/pkgconfig.pc.in
--- old/cxxopts-3.2.1/packaging/pkgconfig.pc.in 2024-02-20 09:39:52.000000000 
+0100
+++ new/cxxopts-3.3.1/packaging/pkgconfig.pc.in 2025-05-26 10:09:26.000000000 
+0200
@@ -3,5 +3,7 @@
 
 Name: @PROJECT_NAME@
 Description: @PROJECT_DESCRIPTION@
+URL: @PROJECT_HOMEPAGE_URL@
 Version: @PROJECT_VERSION@
-Cflags: -I${includedir}
+Requires: @PKG_CONFIG_REQUIRES@
+Cflags: -I${includedir} @PKG_CONFIG_EXTRA_CFLAGS@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/src/CMakeLists.txt 
new/cxxopts-3.3.1/src/CMakeLists.txt
--- old/cxxopts-3.2.1/src/CMakeLists.txt        2024-02-20 09:39:52.000000000 
+0100
+++ new/cxxopts-3.3.1/src/CMakeLists.txt        2025-05-26 10:09:26.000000000 
+0200
@@ -21,4 +21,6 @@
 add_executable(example example.cpp)
 target_link_libraries(example cxxopts)
 
-set_property(TARGET example PROPERTY CXX_STANDARD 17)
+target_compile_features(example PRIVATE cxx_std_17)
+target_compile_options(example PRIVATE
+    "$<$<CXX_COMPILER_ID:MSVC>:/utf-8;>")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/test/CMakeLists.txt 
new/cxxopts-3.3.1/test/CMakeLists.txt
--- old/cxxopts-3.2.1/test/CMakeLists.txt       2024-02-20 09:39:52.000000000 
+0100
+++ new/cxxopts-3.3.1/test/CMakeLists.txt       2025-05-26 10:09:26.000000000 
+0200
@@ -32,6 +32,8 @@
     --build-makeprogram ${CMAKE_MAKE_PROGRAM}
     --build-options
     "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+    "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
+    "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}"
     "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
     "-Dcxxopts_DIR=${PROJECT_BINARY_DIR}"
 )
@@ -46,6 +48,8 @@
     --build-makeprogram ${CMAKE_MAKE_PROGRAM}
     --build-options
     "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+    "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
+    "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}"
     "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
 )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/cxxopts-3.2.1/test/add-subdirectory-test/CMakeLists.txt 
new/cxxopts-3.3.1/test/add-subdirectory-test/CMakeLists.txt
--- old/cxxopts-3.2.1/test/add-subdirectory-test/CMakeLists.txt 2024-02-20 
09:39:52.000000000 +0100
+++ new/cxxopts-3.3.1/test/add-subdirectory-test/CMakeLists.txt 2025-05-26 
10:09:26.000000000 +0200
@@ -1,10 +1,7 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5...3.19)
 
 project(cxxopts-test)
 
-set(CMAKE_CXX_STANDARD   11)
-set(CMAKE_CXX_EXTENSIONS OFF)
-
 add_subdirectory(../.. cxxopts EXCLUDE_FROM_ALL)
 
 add_executable(library-test "../../src/example.cpp")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/test/catch.hpp 
new/cxxopts-3.3.1/test/catch.hpp
--- old/cxxopts-3.2.1/test/catch.hpp    2024-02-20 09:39:52.000000000 +0100
+++ new/cxxopts-3.3.1/test/catch.hpp    2025-05-26 10:09:26.000000000 +0200
@@ -1,9 +1,9 @@
 /*
- *  Catch v2.13.10
- *  Generated: 2022-10-16 11:01:23.452308
+ *  Catch v2.13.11
+ *  Generated: 2024-07-15 17:08:27.065263
  *  ----------------------------------------------------------
  *  This file has been merged from multiple headers. Please don't edit it 
directly
- *  Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved.
+ *  Copyright (c) 2024 Two Blue Cubes Ltd. All rights reserved.
  *
  *  Distributed under the Boost Software License, Version 1.0. (See 
accompanying
  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -15,7 +15,7 @@
 
 #define CATCH_VERSION_MAJOR 2
 #define CATCH_VERSION_MINOR 13
-#define CATCH_VERSION_PATCH 10
+#define CATCH_VERSION_PATCH 11
 
 #ifdef __clang__
 #    pragma clang system_header
@@ -69,6 +69,9 @@
 // See e.g.:
 // 
https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
 #ifdef __APPLE__
+#  ifndef __has_extension
+#    define __has_extension(x) 0
+#  endif
 #  include <TargetConditionals.h>
 #  if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \
       (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1)
@@ -2707,7 +2710,7 @@
         INTERNAL_CATCH_TRY { \
             CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
             CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
-            catchAssertionHandler.handleExpr( Catch::Decomposer() <= 
__VA_ARGS__ ); \
+            catchAssertionHandler.handleExpr( Catch::Decomposer() <= 
__VA_ARGS__ ); /* NOLINT(bugprone-chained-comparison) */ \
             CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
         } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
         INTERNAL_CATCH_REACT( catchAssertionHandler ) \
@@ -10171,7 +10174,10 @@
 
 #elif defined( CATCH_CONFIG_COLOUR_ANSI ) 
//////////////////////////////////////
 
-#include <unistd.h>
+#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC )
+#    define CATCH_INTERNAL_HAS_ISATTY
+#    include <unistd.h>
+#endif
 
 namespace Catch {
 namespace {
@@ -10220,7 +10226,8 @@
 #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
             !isDebuggerActive() &&
 #endif
-#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__))
+#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \
+    !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) )
             isatty(STDOUT_FILENO)
 #else
             false
@@ -15389,7 +15396,7 @@
     }
 
     Version const& libraryVersion() {
-        static Version version( 2, 13, 10, "", 0 );
+        static Version version( 2, 13, 11, "", 0 );
         return version;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/test/find-package-test/CMakeLists.txt 
new/cxxopts-3.3.1/test/find-package-test/CMakeLists.txt
--- old/cxxopts-3.2.1/test/find-package-test/CMakeLists.txt     2024-02-20 
09:39:52.000000000 +0100
+++ new/cxxopts-3.3.1/test/find-package-test/CMakeLists.txt     2025-05-26 
10:09:26.000000000 +0200
@@ -1,10 +1,7 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5...3.19)
 
 project(cxxopts-test)
 
-set(CMAKE_CXX_STANDARD   11)
-set(CMAKE_CXX_EXTENSIONS OFF)
-
 find_package(cxxopts REQUIRED)
 
 add_executable(library-test "../../src/example.cpp")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cxxopts-3.2.1/test/options.cpp 
new/cxxopts-3.3.1/test/options.cpp
--- old/cxxopts-3.2.1/test/options.cpp  2024-02-20 09:39:52.000000000 +0100
+++ new/cxxopts-3.3.1/test/options.cpp  2025-05-26 10:09:26.000000000 +0200
@@ -89,6 +89,7 @@
   auto result = options.parse(argc, actual_argv);
 
   CHECK(result.count("long") == 1);
+  CHECK(result.contains("long"));
   CHECK(result.count("s") == 1);
   CHECK(result.count("value") == 1);
   CHECK(result.count("a") == 1);
@@ -112,6 +113,8 @@
   CHECK(arguments[2].key() == "value");
   CHECK(arguments[3].key() == "av");
 
+  CHECK(result.count("nothing") == 0);
+  CHECK_FALSE(result.contains("nothing"));
   CHECK_THROWS_AS(result["nothing"].as<std::string>(), 
cxxopts::exceptions::option_has_no_value);
 
   CHECK(options.program() == "tester");
@@ -729,6 +732,27 @@
 }
 #endif
 
+#ifdef CXXOPTS_HAS_FILESYSTEM
+TEST_CASE("std::filesystem::path", "[path]") {
+  std::filesystem::path path;
+  cxxopts::Options options("path", " - tests path");
+  options.add_options()
+    ("path", "a path", cxxopts::value<std::filesystem::path>(path));
+
+  Argv av({"path", "--path", "Hello World.txt"});
+
+  auto** argv = av.argv();
+  auto argc = av.argc();
+
+  REQUIRE(path.empty());
+
+  options.parse(argc, argv);
+
+  REQUIRE(!path.empty());
+  CHECK(path == "Hello World.txt");
+}
+#endif
+
 TEST_CASE("Unrecognised options", "[options]") {
   cxxopts::Options options("unknown_options", " - test unknown options");
 
@@ -821,6 +845,113 @@
   CHECK_THROWS_AS(options.parse(argc, argv), 
cxxopts::exceptions::no_such_option);
 }
 
+#ifdef CXXOPTS_HAS_OPTIONAL
+TEST_CASE("Optional value", "[optional]")
+{
+  cxxopts::Options options("options", "query as std::optional");
+  options.add_options()
+    ("int", "Integer", cxxopts::value<int>())
+    ("float", "Float", cxxopts::value<float>())
+    ("string", "String", cxxopts::value<std::string>())
+    ;
+
+  SECTION("Available") {
+    Argv av({
+      "available",
+      "--int",
+      "42",
+      "--float",
+      "3.141",
+      "--string",
+      "Hello"
+    });
+
+    auto** argv = av.argv();
+    auto argc = av.argc();
+
+    auto result = options.parse(argc, argv);
+
+    CHECK(result.as_optional<int>("int"));
+    CHECK(result.as_optional<float>("float"));
+    CHECK(result.as_optional<std::string>("string"));
+
+    CHECK(result.as_optional<int>("int") == 42);
+    CHECK(result.as_optional<float>("float") == 3.141f);
+    CHECK(result.as_optional<std::string>("string") == "Hello");
+  }
+
+  SECTION("Unavailable") {
+    Argv av({
+      "unavailable"
+    });
+
+    auto** argv = av.argv();
+    auto argc = av.argc();
+
+    auto result = options.parse(argc, argv);
+
+    CHECK(!result.as_optional<int>("int"));
+    CHECK(!result.as_optional<float>("float"));
+    CHECK(!result.as_optional<std::string>("string"));
+  }
+
+}
+#endif
+
+#ifdef CXXOPTS_HAS_OPTIONAL
+TEST_CASE("std::filesystem::path value", "[path]")
+{
+  cxxopts::Options options("options", "query as std::fileystem::path");
+  options.add_options()
+    ("a", "Path", cxxopts::value<std::filesystem::path>())
+    ("b", "Path", cxxopts::value<std::filesystem::path>())
+    ("c", "Path", cxxopts::value<std::filesystem::path>())
+    ("d", "Path", cxxopts::value<std::filesystem::path>())
+    ("e", "Path", cxxopts::value<std::filesystem::path>())
+    ;
+
+  SECTION("Available") {
+    Argv av({
+      "available",
+      "-a", "hello.txt",
+      "-b", "C:\\Users\\JoeCitizen\\hello world.txt",
+      "-c", "/home/joecitzen/hello world.txt",
+      "-d", "../world.txt"
+    });
+
+    auto** argv = av.argv();
+    auto argc = av.argc();
+
+    auto result = options.parse(argc, argv);
+
+    CHECK(result.as_optional<std::filesystem::path>("a"));
+    CHECK(result.as_optional<std::filesystem::path>("b"));
+    CHECK(result.as_optional<std::filesystem::path>("c"));
+    CHECK(result.as_optional<std::filesystem::path>("d"));
+    CHECK(!result.as_optional<std::filesystem::path>("e"));
+
+    CHECK(result.as_optional<std::filesystem::path>("a") == "hello.txt");
+    CHECK(result.as_optional<std::filesystem::path>("b") == 
"C:\\Users\\JoeCitizen\\hello world.txt");
+    CHECK(result.as_optional<std::filesystem::path>("c") == 
"/home/joecitzen/hello world.txt");
+    CHECK(result.as_optional<std::filesystem::path>("d") == "../world.txt");
+  }
+
+  SECTION("Unavailable") {
+    Argv av({
+      "unavailable"
+    });
+
+    auto** argv = av.argv();
+    auto argc = av.argc();
+
+    auto result = options.parse(argc, argv);
+
+    CHECK(!result.as_optional<std::filesystem::path>("a"));
+  }
+
+}
+#endif
+
 TEST_CASE("Initializer list with group", "[options]") {
   cxxopts::Options options("Initializer list group", " - test initializer list 
with group");
 

Reply via email to