Merge lp:~rachidbm/ubuntu-l10n-tools/search into lp:ubuntu-l10n-tools

Proposed by Rachid
Status: Needs review
Proposed branch: lp:~rachidbm/ubuntu-l10n-tools/search
Merge into: lp:ubuntu-l10n-tools
Diff against target: 52 lines (+19/-2)
2 files modified
ul10n_tools/search/TranslationsSearch.py (+9/-0)
ul10n_tools/search/__init__.py (+10/-2)
To merge this branch: bzr merge lp:~rachidbm/ubuntu-l10n-tools/search
Reviewer Review Type Date Requested Status
David Planella Pending
Review via email: mp+71596@code.launchpad.net

Description of the change

Added parameter (-p) to print only package names

To post a comment you must log in.

Unmerged revisions

15. By Rachid

Added parameter (-p) to print only package names

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ul10n_tools/search/TranslationsSearch.py'
2--- ul10n_tools/search/TranslationsSearch.py 2011-05-31 08:11:58 +0000
3+++ ul10n_tools/search/TranslationsSearch.py 2011-08-15 18:58:16 +0000
4@@ -124,3 +124,12 @@
5 print "msgstr[{0}]: {1}".format(index,
6 entry.msgstr_plural[index].strip())
7 print
8+
9+
10+ def print_matched_packaged(self):
11+ """
12+ Print a list of matched package names
13+ """
14+ for template_name, entries in self.matches.items():
15+ print "{0}".format(template_name)
16+
17
18=== modified file 'ul10n_tools/search/__init__.py'
19--- ul10n_tools/search/__init__.py 2011-06-08 10:23:11 +0000
20+++ ul10n_tools/search/__init__.py 2011-08-15 18:58:16 +0000
21@@ -63,6 +63,8 @@
22 "in the translations; 'original' looks for the pattern " +
23 "in the original English messages; 'both' looks in both. " +
24 "The default is 'both'."))
25+ parser.add_option('-p', '--list-package-names', dest='list_packages', action='store_true',
26+ help = 'Prints only the names of matched packages')
27 parser.add_option('-v', '--verbose', dest='logging_level', action='count',
28 help = 'Set error_level output to warning, info, and then debug')
29
30@@ -71,7 +73,8 @@
31 parser.set_defaults(logging_level = 0,
32 mode = 'both',
33 ignore_case = False,
34- language = getlocale()[0])
35+ language = getlocale()[0],
36+ list_packages = False)
37 (options, args) = parser.parse_args()
38
39 # Set the verbosity
40@@ -112,6 +115,11 @@
41
42 translations_search = TranslationsSearch(pattern, localedir, options.mode)
43 translations_search.search()
44- translations_search.print_matches()
45+
46+ # Print only package names?
47+ if options.list_packages:
48+ translations_search.print_matched_packaged()
49+ else:
50+ translations_search.print_matches()
51
52 print "{0} match(es) found.".format(len(translations_search.matches.items()))

Subscribers

People subscribed via source and target branches