find_js_files.py revision 46d4c2bc3267f3f028f39e7e311b0f89aba2e4fd
1#!/usr/bin/env python
2
3# Copyright 2014 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7'''Scans one or more directory trees for .js files, printing filenames,
8relative to the current directory on stdout.
9'''
10
11import optparse
12import os
13import sys
14
15_SCRIPT_DIR = os.path.realpath(os.path.dirname(__file__))
16_CHROME_SOURCE = os.path.realpath(
17    os.path.join(_SCRIPT_DIR, *[os.path.pardir] * 6))
18sys.path.insert(
19    0, os.path.join(
20        _CHROME_SOURCE, ('chrome/third_party/chromevox/third_party/' +
21                         'closure-library/closure/bin/build')))
22import treescan
23
24
25def main():
26  parser = optparse.OptionParser(description=__doc__)
27  parser.usage = '%prog <tree_root>...'
28  _, args = parser.parse_args()
29  for root in args:
30    print '\n'.join(treescan.ScanTreeForJsFiles(root))
31
32
33if __name__ == '__main__':
34  main()
35