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

Unified Diff: tools/grit/pak_util.py

Issue 2977993002: Reland of Deduplicate Monochrome locale .paks (Closed)
Patch Set: 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
« no previous file with comments | « chrome/common/descriptors_android.h ('k') | tools/resources/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/pak_util.py
diff --git a/tools/grit/pak_util.py b/tools/grit/pak_util.py
index ec43f33afddae2c0d22756bb76e8903a7b40f3a2..e98f9bd39005ec58200d0aa7c19a2a9d7025644b 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-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()
« no previous file with comments | « chrome/common/descriptors_android.h ('k') | tools/resources/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698