My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

mfadd 753B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. #
  3. # mfadd
  4. #
  5. # Add a remote and fetch it. Optionally copy a branch.
  6. #
  7. # Example: mfadd thinkyhead:patch-1 copy_of_patch-1
  8. #
  9. [[ $# > 0 && $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` (user | ref copyname)" 1>&2 ; exit 1; }
  10. # If a colon is included, split the parts
  11. if [[ $1 =~ ":" ]]; then
  12. IFS=':' read -a DATA <<< "$1"
  13. USER=${DATA[0]}
  14. BRANCH=${DATA[1]}
  15. NAME=$2
  16. else
  17. USER=$1
  18. fi
  19. MFINFO=$(mfinfo) || exit 1
  20. IFS=' ' read -a INFO <<< "$MFINFO"
  21. REPO=${INFO[2]}
  22. set -e
  23. echo "Adding and fetching $USER..."
  24. git remote add "$USER" "git@github.com:$USER/$REPO.git" >/dev/null 2>&1 || echo "Remote exists."
  25. git fetch "$USER"
  26. [[ ! -z "$BRANCH" && ! -z "$NAME" ]] && git checkout $USER/$BRANCH -b $NAME