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.

mfadd 771B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. #
  3. # mfadd (user|ref) [copyname]
  4. #
  5. # Add a remote and fetch it. Optionally copy a branch.
  6. #
  7. # Example: mfadd myfork: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