main.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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'] == 'help':
  24. print('help')
  25. elif args['cmd'] == 'version':
  26. print('version')
  27. else:
  28. print(f"{bcolors.FAIL}Please input path {bcolors.ENDC}")
  29. except Exception as e:
  30. print(e)
  31. print(f"{bcolors.FAIL}Please input path {bcolors.ENDC}")