__main__.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env python
  2. # License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
  3. import os
  4. import sys
  5. from typing import List
  6. def main(args: List[str]=sys.argv) -> None:
  7. os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  8. sys.path.insert(0, os.getcwd())
  9. if len(args) == 1:
  10. raise SystemExit('usage: python gen which')
  11. which = args[1]
  12. del args[1]
  13. if which == 'apc-parsers':
  14. from gen.apc_parsers import main
  15. main(args)
  16. elif which == 'config':
  17. from gen.config import main
  18. main(args)
  19. elif which == 'srgb-lut':
  20. from gen.srgb_lut import main
  21. main(args)
  22. elif which == 'key-constants':
  23. from gen.key_constants import main
  24. main(args)
  25. elif which == 'go-code':
  26. from gen.go_code import main
  27. main(args)
  28. elif which == 'wcwidth':
  29. from gen.wcwidth import main
  30. main(args)
  31. elif which == 'cursors':
  32. from gen.cursors import main
  33. main(args)
  34. else:
  35. raise SystemExit(f'Unknown which: {which}')
  36. if __name__ == '__main__':
  37. main()