My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mfinfo 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. #
  3. # mfinfo
  4. #
  5. # Provide the following info about the working directory:
  6. #
  7. # - Remote (upstream) Org name (MarlinFirmware)
  8. # - Remote (origin) Org name (your Github username)
  9. # - Repo Name (Marlin, MarlinDev, MarlinDocumentation)
  10. # - PR Target branch (bugfix-1.1.x, dev, or master)
  11. # - Branch Arg (the branch argument or current branch)
  12. # - Current Branch
  13. #
  14. CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
  15. [[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; }
  16. [[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; }
  17. REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
  18. [[ -z $REPO ]] && { echo "`basename $0`: No 'upstream' remote found. (Did you run mfinit?)" 1>&2 ; exit 1; }
  19. ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
  20. [[ $ORG == MarlinFirmware ]] || { echo "`basename $0`: Not a Marlin repository." 1>&2 ; exit 1; }
  21. case "$REPO" in
  22. Marlin ) TARG=bugfix-1.1.x ;;
  23. MarlinDev ) TARG=dev ;;
  24. MarlinDocumentation ) TARG=master ;;
  25. esac
  26. FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
  27. case "$#" in
  28. 0 ) BRANCH=$CURR ;;
  29. 1 ) BRANCH=$1 ;;
  30. * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
  31. esac
  32. echo "$ORG $FORK $REPO $TARG $BRANCH $CURR"