Peter van Westen committed bb76865

Added --silent option to pull command, which only outputs pulled files and no other process information

  • Participants
  • Parent commits 6402afa

Comments (0)

Files changed (3)

File txclib/

     languages = parse_csv_option(options.languages)
     resources = parse_csv_option(options.resources)
     skip = options.skip_errors
+    silent = options.silent
     minimum_perc = options.minimum_perc or None
         languages=languages, resources=resources, overwrite=options.overwrite,
         fetchall=options.fetchall, fetchsource=options.fetchsource,
-        force=options.force, skip=skip, minimum_perc=minimum_perc,
-        mode=options.mode
+        force=options.force, skip=skip, silent=silent,
+        minimum_perc=minimum_perc, mode=options.mode

File txclib/

     parser.add_option("--skip", action="store_true", dest="skip_errors",
         default=False, help="Don't stop on errors. Useful when pushing many"
         " files concurrently.")
+    parser.add_option("--silent", action="store_true", dest="silent",
+        default=False, help="Will only show the pulled files. No other process information.")
     parser.add_option("--disable-overwrite", action="store_false",
         dest="overwrite", default=True,
         help="By default transifex will fetch new translations files and"\

File txclib/

             return os.path.join(self.root, relpath)
     def pull(self, languages=[], resources=[], overwrite=True, fetchall=False,
-        fetchsource=False, force=False, skip=False, minimum_perc=0, mode=None):
+        fetchsource=False, force=False, skip=False, silent=False, minimum_perc=0, mode=None):
         """Pull all translations file from transifex server."""
         self.minimum_perc = minimum_perc
         resource_list = self.get_chosen_resources(resources)
                     files, slang, lang_map, stats, force
                 if new_translations:
-          "New translations found for the following languages: %s" %
-                        ', '.join(new_translations))
+                    if not silent:
+              "New translations found for the following languages: %s" %
+                            ', '.join(new_translations))
             existing, new = self._languages_to_pull(
                 languages, files, lang_map, stats, force
             if pull_languages:
                 logger.debug("Pulling languages for: %s" % pull_languages)
-      "Pulling translations for resource %s (source: %s)" %
-                    (resource, sfile))
+                if not silent:
+          "Pulling translations for resource %s (source: %s)" %
+                        (resource, sfile))
             for lang in pull_languages:
                 local_lang = lang
                     'mode': mode,
                 if not self._should_update_translation(**kwargs):
-                    msg = "Skipping '%s' translation (file: %s)."
-           % (color_text(remote_lang, "RED"), local_file))
+                    if not silent:
+                        msg = "Skipping '%s' translation (file: %s)."
+               % (color_text(remote_lang, "RED"), local_file))
                 if not overwrite:
             if new_translations:
-      "Pulling new translations for resource %s (source: %s)" %
-                (resource, sfile))
+                if not silent:
+          "Pulling new translations for resource %s (source: %s)" %
+                    (resource, sfile))
                 for lang in new_translations:
                     if lang in lang_map.keys():
                         local_lang = lang_map[lang]