mfqp 636 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. #
  3. # mfqp [1|2|3]
  4. #
  5. # - git add .
  6. # - git commit --amend
  7. # - ghpc
  8. #
  9. MFINFO=$(mfinfo "$@") || exit 1
  10. IFS=' ' read -a INFO <<< "$MFINFO"
  11. REPO=${INFO[2]}
  12. TARG=${INFO[3]}
  13. CURR=${INFO[5]}
  14. IND=6
  15. while [ $IND -lt ${#INFO[@]} ]; do
  16. ARG=${INFO[$IND]}
  17. case "$ARG" in
  18. -h|--help ) USAGE=1 ;;
  19. * ) USAGE=1 ; echo "unknown option: $ARG" ;;
  20. esac
  21. let IND+=1
  22. done
  23. [[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3]" 1>&2 ; exit 1 ; }
  24. [[ $CURR == $TARG && $REPO != "MarlinDocumentation" ]] && { echo "Don't alter the PR Target branch."; exit 1 ; }
  25. git add . && git commit --amend && git push -f