mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 14:44:40 +00:00
Merge pull request #386 from DapengFeng/master
support `store_into` std::filesystem::path
This commit is contained in:
commit
e39aa895ab
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user