Merge pull request #386 from DapengFeng/master

support `store_into` std::filesystem::path
This commit is contained in:
Pranav 2025-01-20 13:14:56 -05:00 committed by GitHub
commit e39aa895ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,7 @@ SOFTWARE.
#include <utility>
#include <variant>
#include <vector>
#include <filesystem>
#endif
#ifndef ARGPARSE_CUSTOM_STRTOF
@ -738,6 +739,14 @@ public:
return *this;
}
auto &store_into(std::filesystem::path &var) {
if (m_default_value.has_value()) {
var = std::any_cast<std::filesystem::path>(m_default_value);
}
action([&var](const std::string &s) { var = s; });
return *this;
}
auto &store_into(std::vector<std::string> &var) {
if (m_default_value.has_value()) {
var = std::any_cast<std::vector<std::string>>(m_default_value);