Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: tools/grit/pak_util.py

Issue 2977993002: Reland of Deduplicate Monochrome locale .paks (Closed)
Patch Set: Fixes Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/grit/pak_util.py
diff --git a/tools/grit/pak_util.py b/tools/grit/pak_util.py
index ec43f33afddae2c0d22756bb76e8903a7b40f3a2..40408642f451f667d6aeede1110d1ac1da06fa9a 100755
--- a/tools/grit/pak_util.py
+++ b/tools/grit/pak_util.py
@@ -62,6 +62,12 @@ def _PrintMain(args):
print line.encode('utf-8')
+def _ListMain(args):
+ resources, _ = data_pack.ReadDataPack(args.pak_file)
+ for resource_id in sorted(resources.keys()):
+ args.output.write('%d\n' % resource_id)
+
+
def main():
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
@@ -88,6 +94,14 @@ def main():
help='Prints all pak IDs and contents. Useful for diffing.')
sub_parser.add_argument('pak_file')
sub_parser.set_defaults(func=_PrintMain)
+
+ sub_parser = sub_parsers.add_parser('list',
agrieve 2017/07/17 13:50:52 nit: Might be nice to just make "print" more capab
F 2017/07/17 14:35:14 Resolved offline. Name changed to "list-id"
+ help='Outputs all resource IDs to a file.')
+ sub_parser.add_argument('pak_file')
+ sub_parser.add_argument('--output', type=argparse.FileType('w'),
+ default=sys.stdout,
+ help='The resource list path to write (default stdout)')
+ sub_parser.set_defaults(func=_ListMain)
if len(sys.argv) == 1:
parser.print_help()

Powered by Google App Engine
This is Rietveld 408576698