mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54:39 +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 <utility>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <filesystem>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ARGPARSE_CUSTOM_STRTOF
|
#ifndef ARGPARSE_CUSTOM_STRTOF
|
||||||
@ -730,6 +731,14 @@ public:
|
|||||||
return *this;
|
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) {
|
auto &store_into(std::vector<std::string> &var) {
|
||||||
if (m_default_value.has_value()) {
|
if (m_default_value.has_value()) {
|
||||||
var = std::any_cast<std::vector<std::string>>(m_default_value);
|
var = std::any_cast<std::vector<std::string>>(m_default_value);
|
||||||
|
Loading…
Reference in New Issue
Block a user