summaryrefslogtreecommitdiff
path: root/src/OptionHandler.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-12-03 16:30:00 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-12-03 16:30:00 +0900
commit6bf696ca112c0ce061fb1b6a351dd2227fbedb67 (patch)
treefa091b84f4bad0dd3818a10d7d988f1412f1cec1 /src/OptionHandler.cc
parentf77da0d11202ad42d10989c48403dddfcbb34796 (diff)
New help messages. Added suggestion for unknown/ambiguous options.
The help messages shown when argument error were redesigned and less verbose now. When unknown or ambiguous option is given, show suggestions like "Did you mean...". Some constant values related to levenstein distance are borrowed from git help.c.
Diffstat (limited to 'src/OptionHandler.cc')
-rw-r--r--src/OptionHandler.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/OptionHandler.cc b/src/OptionHandler.cc
index 7ec941f9..e03d1756 100644
--- a/src/OptionHandler.cc
+++ b/src/OptionHandler.cc
@@ -64,4 +64,17 @@ std::ostream& operator<<(std::ostream& o, const OptionHandler& optionHandler)
return o;
}
+void write(const Console& out, const OptionHandler& optionHandler)
+{
+ out->printf("%s\n\n", optionHandler.getDescription());
+ std::string possibleValues = optionHandler.createPossibleValuesString();
+ if(!possibleValues.empty()) {
+ out->printf("%s%s\n", POSSIBLE_MSG, possibleValues.c_str());
+ }
+ if(!optionHandler.getDefaultValue().empty()) {
+ out->printf("%s%s\n", DEFAULT_MSG, optionHandler.getDefaultValue().c_str());
+ }
+ out->printf("%s%s\n", TAGS_MSG, optionHandler.toTagString().c_str());
+}
+
} // namespace aria2