aboutsummaryrefslogtreecommitdiff
path: root/src/common/command_line.cpp
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2017-10-19 21:57:49 +0900
committerstoffu <stoffu@protonmail.ch>2017-11-14 16:33:17 +0900
commit105425b7f69ae115ec287242fdf12d6a8458a10f (patch)
treefafc948c6e9ad0b0275c46e3972b30cccf126ef3 /src/common/command_line.cpp
parentMerge pull request #2694 (diff)
downloadmonero-105425b7f69ae115ec287242fdf12d6a8458a10f.tar.xz
simplewallet: reject invalid argument for boolean parameter
Diffstat (limited to 'src/common/command_line.cpp')
-rw-r--r--src/common/command_line.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp
index 666b3267f..d4a28fc85 100644
--- a/src/common/command_line.cpp
+++ b/src/common/command_line.cpp
@@ -78,6 +78,20 @@ namespace command_line
return false;
}
+ bool is_no(const std::string& str)
+ {
+ if (str == "n" || str == "N")
+ return true;
+
+ boost::algorithm::is_iequal ignore_case{};
+ if (boost::algorithm::equals("no", str, ignore_case))
+ return true;
+ if (boost::algorithm::equals(command_line::tr("no"), str, ignore_case))
+ return true;
+
+ return false;
+ }
+
const arg_descriptor<bool> arg_help = {"help", "Produce help message"};
const arg_descriptor<bool> arg_version = {"version", "Output version information"};
const arg_descriptor<std::string> arg_data_dir = {"data-dir", "Specify data directory"};