1 from __future__ import print_function, division, absolute_import 2 import sys 3 4 5 def main(args=None): 6 if args is None: 7 args = sys.argv[1:] 8 9 # TODO Add help output, --help, etc. 10 11 # TODO Handle library-wide options. Eg.: 12 # --unicodedata 13 # --verbose / other logging stuff 14 15 # TODO Allow a way to run arbitrary modules? Useful for setting 16 # library-wide options and calling another library. Eg.: 17 # 18 # $ fonttools --unicodedata=... fontmake ... 19 # 20 # This allows for a git-like command where thirdparty commands 21 # can be added. Should we just try importing the fonttools 22 # module first and try without if it fails? 23 24 mod = 'fontTools.'+sys.argv[1] 25 sys.argv[1] = sys.argv[0] + ' ' + sys.argv[1] 26 del sys.argv[0] 27 28 import runpy 29 runpy.run_module(mod, run_name='__main__') 30 31 32 if __name__ == '__main__': 33 sys.exit(main()) 34