Bladeren bron

Add "hide" to --download-result option

Tatsuhiro Tsujikawa 9 jaren geleden
bovenliggende
commit
aa863fa4d1
5 gewijzigde bestanden met toevoegingen van 11 en 7 verwijderingen
  1. 2 1
      src/MultiUrlRequestInfo.cc
  2. 3 3
      src/OptionHandlerFactory.cc
  3. 2 1
      src/prefs.cc
  4. 2 1
      src/prefs.h
  5. 2 1
      src/usage_text.h

+ 2 - 1
src/MultiUrlRequestInfo.cc

@@ -315,7 +315,8 @@ error_code::Value MultiUrlRequestInfo::getResult()
   if (!serverStatOf.empty()) {
     e_->getRequestGroupMan()->saveServerStat(serverStatOf);
   }
-  if (!option_->getAsBool(PREF_QUIET)) {
+  if (!option_->getAsBool(PREF_QUIET) &&
+      option_->get(PREF_DOWNLOAD_RESULT) != A2_V_HIDE) {
     e_->getRequestGroupMan()->showDownloadResults(
         *global::cout(), option_->get(PREF_DOWNLOAD_RESULT) == A2_V_FULL);
     global::cout()->flush();

+ 3 - 3
src/OptionHandlerFactory.cc

@@ -235,9 +235,9 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
     handlers.push_back(op);
   }
   {
-    OptionHandler* op(
-        new ParameterOptionHandler(PREF_DOWNLOAD_RESULT, TEXT_DOWNLOAD_RESULT,
-                                   A2_V_DEFAULT, {A2_V_DEFAULT, A2_V_FULL}));
+    OptionHandler* op(new ParameterOptionHandler(
+        PREF_DOWNLOAD_RESULT, TEXT_DOWNLOAD_RESULT, A2_V_DEFAULT,
+        {A2_V_DEFAULT, A2_V_FULL, A2_V_HIDE}));
     op->addTag(TAG_ADVANCED);
     op->setChangeGlobalOption(true);
     handlers.push_back(op);

+ 2 - 1
src/prefs.cc

@@ -121,6 +121,7 @@ const std::string V_NONE("none");
 const std::string V_MEM("mem");
 const std::string V_ALL("all");
 const std::string A2_V_FULL("full");
+const std::string A2_V_HIDE("hide");
 const std::string A2_V_GEOM("geom");
 const std::string V_PREALLOC("prealloc");
 const std::string V_FALLOC("falloc");
@@ -336,7 +337,7 @@ PrefPtr PREF_STREAM_PIECE_SELECTOR = makePref("stream-piece-selector");
 PrefPtr PREF_TRUNCATE_CONSOLE_READOUT = makePref("truncate-console-readout");
 // value: true | false
 PrefPtr PREF_PAUSE = makePref("pause");
-// value: default | full
+// value: default | full | hide
 PrefPtr PREF_DOWNLOAD_RESULT = makePref("download-result");
 // value: true | false
 PrefPtr PREF_HASH_CHECK_ONLY = makePref("hash-check-only");

+ 2 - 1
src/prefs.h

@@ -78,6 +78,7 @@ extern const std::string V_NONE;
 extern const std::string V_MEM;
 extern const std::string V_ALL;
 extern const std::string A2_V_FULL;
+extern const std::string A2_V_HIDE;
 extern const std::string A2_V_GEOM;
 extern const std::string V_PREALLOC;
 extern const std::string V_FALLOC;
@@ -289,7 +290,7 @@ extern PrefPtr PREF_STREAM_PIECE_SELECTOR;
 extern PrefPtr PREF_TRUNCATE_CONSOLE_READOUT;
 // value: true | false
 extern PrefPtr PREF_PAUSE;
-// value: default | full
+// value: default | full | hide
 extern PrefPtr PREF_DOWNLOAD_RESULT;
 // value: true | false
 extern PrefPtr PREF_HASH_CHECK_ONLY;

+ 2 - 1
src/usage_text.h

@@ -882,7 +882,8 @@
     "                              download speed, percentage of progress and\n" \
     "                              path/URI. The percentage of progress and\n" \
     "                              path/URI are printed for each requested file in\n" \
-    "                              each row.")
+    "                              each row.\n" \
+    "                              If OPT is 'hide', \"Download Result\" is hidden.")
 #define TEXT_HASH_CHECK_ONLY                    \
   _(" --hash-check-only[=true|false] If true is given, after hash check using\n" \
     "                              --check-integrity option, abort download whether\n" \