refactor
This commit is contained in:
parent
0c075d7fe4
commit
ee415d2e4a
@ -76,7 +76,7 @@ auto has_option(std::vector<const char *> args, const std::string &option_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto has_option(std::vector<const char *> args, const option &opt) -> bool {
|
auto has_option(std::vector<const char *> args, const option &opt) -> bool {
|
||||||
return has_option(args, opt[0U]) || has_option(args, opt[1U]);
|
return has_option(args, opt.at(0U)) || has_option(args, opt.at(1U));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto parse_option(std::vector<const char *> args,
|
auto parse_option(std::vector<const char *> args,
|
||||||
@ -130,19 +130,19 @@ auto parse_drive_options(std::vector<const char *> args,
|
|||||||
const auto &arg = args.at(i);
|
const auto &arg = args.at(i);
|
||||||
if (std::find_if(option_list.begin(), option_list.end(),
|
if (std::find_if(option_list.begin(), option_list.end(),
|
||||||
[&arg](const auto &pair) -> bool {
|
[&arg](const auto &pair) -> bool {
|
||||||
return ((pair[0] == arg) || (pair[1] == arg));
|
return ((pair.at(0U) == arg) || (pair.at(1U) == arg));
|
||||||
}) == option_list.end()) {
|
}) == option_list.end()) {
|
||||||
drive_args.emplace_back(args.at(i));
|
drive_args.emplace_back(args.at(i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((std::string(args.at(i)) == options::remote_mount_option[0U]) ||
|
if ((std::string(args.at(i)) == options::remote_mount_option.at(0U)) ||
|
||||||
(std::string(args.at(i)) == options::remote_mount_option[1U]) ||
|
(std::string(args.at(i)) == options::remote_mount_option.at(1U)) ||
|
||||||
(std::string(args.at(i)) == options::data_directory_option[0U]) ||
|
(std::string(args.at(i)) == options::data_directory_option.at(0U)) ||
|
||||||
(std::string(args.at(i)) == options::data_directory_option[1U])
|
(std::string(args.at(i)) == options::data_directory_option.at(1U))
|
||||||
#ifdef REPERTORY_ENABLE_S3
|
#ifdef REPERTORY_ENABLE_S3
|
||||||
|| (std::string(args.at(i)) == options::name_option[0U]) ||
|
|| (std::string(args.at(i)) == options::name_option.at(0U)) ||
|
||||||
(std::string(args.at(i)) == options::name_option[1U])
|
(std::string(args.at(i)) == options::name_option.at(1U))
|
||||||
#endif // REPERTORY_ENABLE_S3
|
#endif // REPERTORY_ENABLE_S3
|
||||||
) {
|
) {
|
||||||
i++;
|
i++;
|
||||||
@ -175,7 +175,7 @@ auto parse_drive_options(std::vector<const char *> args,
|
|||||||
(fuse_option.find("data_directory") == 0)) {
|
(fuse_option.find("data_directory") == 0)) {
|
||||||
const auto data = utils::string::split(fuse_option, '=');
|
const auto data = utils::string::split(fuse_option, '=');
|
||||||
if (data.size() == 2U) {
|
if (data.size() == 2U) {
|
||||||
data_directory = data.at(1);
|
data_directory = data.at(1U);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Invalid syntax for '-dd,--data_directory'"
|
std::cerr << "Invalid syntax for '-dd,--data_directory'"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user