summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--src/option_processing.cc15
2 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ee9afffd..59983194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+
+ Remove leading "--" from help keyword and a substring after "="
+ from help keyword, so that one can query options by '-h--max-' or
+ '-hmax-peers=10'.
+ * src/option_processing.cc
+
2009-01-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten PStringVisitor and its implementation.
diff --git a/src/option_processing.cc b/src/option_processing.cc
index 0a810749..a5304a9a 100644
--- a/src/option_processing.cc
+++ b/src/option_processing.cc
@@ -578,13 +578,20 @@ Option* option_processing(int argc, char* const argv[])
exit(DownloadResult::FINISHED);
case 'h':
{
- std::string category;
+ std::string keyword;
if(optarg == 0 || strlen(optarg) == 0) {
- category = TAG_BASIC;
+ keyword = TAG_BASIC;
} else {
- category = optarg;
+ keyword = optarg;
+ if(Util::startsWith(keyword, "--")) {
+ keyword = keyword.substr(2);
+ }
+ std::string::size_type eqpos = keyword.find("=");
+ if(eqpos != std::string::npos) {
+ keyword = keyword.substr(0, eqpos);
+ }
}
- showUsage(category, oparser);
+ showUsage(keyword, oparser);
exit(DownloadResult::FINISHED);
}
default: