Commits

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/commands.py

     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
 
     try:
     prj.pull(
         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
     )
     logger.info("Done.")
 

File txclib/parsers.py

     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/project.py

             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:
-                    logger.info("New translations found for the following languages: %s" %
-                        ', '.join(new_translations))
+                    if not silent:
+                        logger.info("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)
-                logger.info("Pulling translations for resource %s (source: %s)" %
-                    (resource, sfile))
+                if not silent:
+                    logger.info("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)."
-                    logger.info(msg % (color_text(remote_lang, "RED"), local_file))
+                    if not silent:
+                        msg = "Skipping '%s' translation (file: %s)."
+                        logger.info(msg % (color_text(remote_lang, "RED"), local_file))
                     continue
 
                 if not overwrite:
                 fd.close()
 
             if new_translations:
-                logger.info("Pulling new translations for resource %s (source: %s)" %
-                (resource, sfile))
+                if not silent:
+                    logger.info("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]