diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-01-27 12:40:44 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-01-27 12:40:44 +0000 |
| commit | 120ea4c609b28c7fd3d907f1fa689737df92b8ef (patch) | |
| tree | 142c84a88bc3751db6b1e5baf3c566a6dd92aaed /src/option_processing.cc | |
| parent | 873231fe1e8203204f4dbf22e1e2c8283ebc7a12 (diff) | |
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
Diffstat (limited to 'src/option_processing.cc')
| -rw-r--r-- | src/option_processing.cc | 15 |
1 files changed, 11 insertions, 4 deletions
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: |
