gw.py 757 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. # gw.py
  3. #
  4. # Greaseweazle control script.
  5. #
  6. # Written & released by Keir Fraser <keir.xen@gmail.com>
  7. #
  8. # This is free and unencumbered software released into the public domain.
  9. # See the file COPYING for more details, or visit <http://unlicense.org>.
  10. import sys
  11. import importlib
  12. actions = [ 'read', 'write', 'delays', 'update' ]
  13. argv = sys.argv
  14. if len(argv) < 2 or argv[1] not in actions:
  15. print("Usage: %s [action] ..." % (argv[0]))
  16. print("Actions: ", end="")
  17. print(", ".join(str(x) for x in actions))
  18. sys.exit(1)
  19. mod = importlib.import_module('greaseweazle.tools.' + argv[1])
  20. main = mod.__dict__['main']
  21. res = main(argv)
  22. if res is None:
  23. res = 0
  24. sys.exit(res)
  25. # Local variables:
  26. # python-indent: 4
  27. # End: