mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 14:44:40 +00:00
support store_into
std::filesystem::path
This commit is contained in:
parent
cbd9fd8ed6
commit
ba077697d6
@ -57,6 +57,7 @@ SOFTWARE.
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
#endif
|
||||
|
||||
#ifndef ARGPARSE_CUSTOM_STRTOF
|
||||
@ -730,6 +731,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);
|
||||
|
Loading…
Reference in New Issue
Block a user