__main__.py 1.1 KB

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