diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-10-22 01:03:14 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-10-22 01:03:14 +0900 |
| commit | d5c8d048efeb524d5d2222b4547f9dd19e943f13 (patch) | |
| tree | 117dd74fff2594be1ee6d6ba00dc9d8c301bf05e /src/version_usage.cc | |
| parent | 3832ed97c616eff0057d7a0e5a161c4282537160 (diff) | |
Rewritten OptionParser. Made it simpler and efficient.
Diffstat (limited to 'src/version_usage.cc')
| -rw-r--r-- | src/version_usage.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/version_usage.cc b/src/version_usage.cc index ed5d7e7f..6ae98a84 100644 --- a/src/version_usage.cc +++ b/src/version_usage.cc @@ -80,20 +80,22 @@ void showVersion() { << _("Visit") << " " << PACKAGE_URL << std::endl; } -void showUsage(const std::string& keyword, const OptionParser& oparser) { +void showUsage +(const std::string& keyword, + const SharedHandle<OptionParser>& oparser) { std::cout << _("Usage: aria2c [OPTIONS] [URI | MAGNET | TORRENT_FILE |" " METALINK_FILE]...") << "\n" << "\n"; if(util::startsWith(keyword, "#")) { std::vector<SharedHandle<OptionHandler> > handlers = - keyword == TAG_ALL ? oparser.findAll():oparser.findByTag(keyword); + keyword == TAG_ALL ? oparser->findAll() : oparser->findByTag(keyword); if(keyword == TAG_ALL) { std::cout << _("Printing all options."); } else { std::cout << fmt(_("Printing options tagged with '%s'."), keyword.c_str()); std::cout << "\n"; - SharedHandle<OptionHandler> help = oparser.findByName("help"); + const SharedHandle<OptionHandler>& help = oparser->find(PREF_HELP); std::cout << fmt(_("See -h option to know other command-line" " options(%s)."), help->createPossibleValuesString().c_str()); @@ -106,7 +108,7 @@ void showUsage(const std::string& keyword, const OptionParser& oparser) { } } else { std::vector<SharedHandle<OptionHandler> > handlers = - oparser.findByNameSubstring(keyword); + oparser->findByNameSubstring(keyword); if(!handlers.empty()) { std::cout << fmt(_("Printing options whose name includes '%s'."), keyword.c_str()) @@ -119,7 +121,7 @@ void showUsage(const std::string& keyword, const OptionParser& oparser) { } else { std::cout << fmt(_("No option matching with '%s'."), keyword.c_str()) - << "\n" << *oparser.findByName("help") << "\n"; + << "\n" << *oparser->find(PREF_HELP) << "\n"; } } |
