"test/gemm/gemm_xdl_int8.cpp" did not exist on "d91f9f119c167ac5f3974e78f09bdd007f5dfd4a"
Commit 442cbc1b authored by Paul's avatar Paul
Browse files

Format

parent f6216e40
...@@ -182,8 +182,10 @@ struct argument_parser ...@@ -182,8 +182,10 @@ struct argument_parser
{ {
struct argument struct argument
{ {
using action_function = std::function<bool(argument_parser&, const std::vector<std::string>&)>; using action_function =
using validate_function = std::function<void(const argument_parser&, const std::vector<std::string>&)>; std::function<bool(argument_parser&, const std::vector<std::string>&)>;
using validate_function =
std::function<void(const argument_parser&, const std::vector<std::string>&)>;
std::vector<std::string> flags; std::vector<std::string> flags;
action_function action{}; action_function action{};
std::string type = ""; std::string type = "";
...@@ -225,7 +227,7 @@ struct argument_parser ...@@ -225,7 +227,7 @@ struct argument_parser
arguments.push_back({flags, [&](auto&&, const std::vector<std::string>& params) { arguments.push_back({flags, [&](auto&&, const std::vector<std::string>& params) {
if(params.empty()) if(params.empty())
throw std::runtime_error("Flag with no value."); throw std::runtime_error("Flag with no value.");
if (not is_multi_value<T>{} and params.size() > 1) if(not is_multi_value<T>{} and params.size() > 1)
throw std::runtime_error("Too many arguments passed."); throw std::runtime_error("Too many arguments passed.");
x = value_parser<T>::apply(params.back()); x = value_parser<T>::apply(params.back());
return false; return false;
...@@ -297,18 +299,17 @@ struct argument_parser ...@@ -297,18 +299,17 @@ struct argument_parser
MIGRAPHX_DRIVER_STATIC auto validate(F f) MIGRAPHX_DRIVER_STATIC auto validate(F f)
{ {
return [=](const auto& x, auto& arg) { return [=](const auto& x, auto& arg) {
arg.validations.push_back([&, f](auto& self, const std::vector<std::string>& params) { arg.validations.push_back(
f(self, x, params); [&, f](auto& self, const std::vector<std::string>& params) { f(self, x, params); });
});
}; };
} }
MIGRAPHX_DRIVER_STATIC auto file_exist() MIGRAPHX_DRIVER_STATIC auto file_exist()
{ {
return validate([](auto&, auto&, auto& params) { return validate([](auto&, auto&, auto& params) {
if (params.empty()) if(params.empty())
throw std::runtime_error("No argument passed."); throw std::runtime_error("No argument passed.");
if (not fs::exists(params.back())) if(not fs::exists(params.back()))
throw std::runtime_error("Path does not exists: " + params.back()); throw std::runtime_error("Path does not exists: " + params.back());
}); });
} }
...@@ -448,7 +449,7 @@ struct argument_parser ...@@ -448,7 +449,7 @@ struct argument_parser
{ {
std::cout << color::fg_yellow << "USAGE:" << color::reset << std::endl; std::cout << color::fg_yellow << "USAGE:" << color::reset << std::endl;
std::cout << " " << exe_name << " "; std::cout << " " << exe_name << " ";
if (flag.empty()) if(flag.empty())
{ {
std::cout << arg.metavar; std::cout << arg.metavar;
} }
...@@ -501,7 +502,7 @@ struct argument_parser ...@@ -501,7 +502,7 @@ struct argument_parser
std::string msg = ""; std::string msg = "";
try try
{ {
for(const auto& v:arg.validations) for(const auto& v : arg.validations)
v(*this, inputs); v(*this, inputs);
return arg.action(*this, inputs); return arg.action(*this, inputs);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment