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
pull/1/head
Tatsuhiro Tsujikawa 2009-01-27 12:40:44 +00:00
parent 873231fe1e
commit 120ea4c609
2 changed files with 18 additions and 4 deletions

View File

@ -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.

View File

@ -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: