main.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. """
  4. @Contact : liuyuqi.gov@msn.cn
  5. @Time : 2024/07/22
  6. @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
  7. @Desc : enter point
  8. """
  9. from auto_commit.utils.colors import bcolors
  10. from auto_commit.auto_commit import AutoCommit
  11. from auto_commit.options import parse_args
  12. if __name__=='__main__':
  13. args = parse_args()
  14. print(args['cmd'])
  15. try:
  16. if args['path'] is not None and args['cmd'] is not None:
  17. if args['cmd'] == 'commit':
  18. auto_commit = AutoCommit(params=args)
  19. auto_commit.commit()
  20. elif args['cmd'] == 'sync':
  21. auto_commit = AutoCommit(params=args)
  22. auto_commit.sync()
  23. elif args['cmd'] == 'check':
  24. auto_commit = AutoCommit(params=args)
  25. auto_commit.check()
  26. elif args['cmd'] == 'help':
  27. print('help')
  28. elif args['cmd'] == 'version':
  29. print('version')
  30. else:
  31. print(f"{bcolors.FAIL}Please input path {bcolors.ENDC}")
  32. except Exception as e:
  33. print(e)
  34. print(f"{bcolors.FAIL}Please input path {bcolors.ENDC}")