Mercurial > hg > config
view python/lsexts.py @ 631:d87a17e1abac
-> http://k0s.org/hg/TextShaper/rev/e6f680d25d63
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 23 Feb 2014 00:49:18 -0800 |
parents | 5f186e65da09 |
children |
line wrap: on
line source
#!/usr/bin/env python import os def extensions(*filenames): return set([os.path.splitext(f)[-1] for f in filenames if '.' in f]) def find_extensions(*directories): _extensions = set() for directory in directories: for _, _, fnames in os.walk(directory): _extensions.update(extensions(*fnames)) return _extensions if __name__ == '__main__': import sys for ext in sorted(find_extensions(*(sys.argv[1:] or [os.getcwd()]))): print ext