Browse Source

Patch up OPEN command in git scripts

pull/1/head
Scott Lahteine 5 years ago
parent
commit
b82c0978cc
  1. 8
      buildroot/share/git/firstpush
  2. 8
      buildroot/share/git/mfdoc
  3. 8
      buildroot/share/git/mfpr
  4. 16
      buildroot/share/git/mfpub

8
buildroot/share/git/firstpush

@ -16,13 +16,15 @@ BRANCH=${INFO[5]}
git push --set-upstream origin $BRANCH git push --set-upstream origin $BRANCH
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') which xdg-open >/dev/null && TOOL=xdg-open
which gnome-open >/dev/null && TOOL=gnome-open
which open >/dev/null && TOOL=open
URL="https://github.com/$FORK/$REPO/commits/$BRANCH" URL="https://github.com/$FORK/$REPO/commits/$BRANCH"
if [ -z "$TOOL" ]; then if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:" echo "Can't find a tool to open the URL:"
echo $URL echo $URL
else else
echo "Viewing commits on $BRANCH..." echo "Viewing commits on $BRANCH..."
"$TOOL" "$URL" "$OPEN" "$URL"
fi fi

8
buildroot/share/git/mfdoc

@ -16,14 +16,16 @@ BRANCH=${INFO[5]}
[[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; } [[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; }
opensite() { opensite() {
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') which xdg-open >/dev/null && TOOL=xdg-open
which gnome-open >/dev/null && TOOL=gnome-open
which open >/dev/null && TOOL=open
URL="http://127.0.0.1:4000/" URL="http://127.0.0.1:4000/"
if [ -z "$TOOL" ]; then if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:" echo "Can't find a tool to open the URL:"
echo $URL echo $URL
else else
echo "Opening preview site in the browser..." echo "Opening preview site in the browser..."
"$TOOL" "$URL" "$OPEN" "$URL"
fi fi
} }

8
buildroot/share/git/mfpr

@ -23,15 +23,17 @@ OLDBRANCH=${INFO[5]}
# See if it's been pushed yet # See if it's been pushed yet
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') which xdg-open >/dev/null && TOOL=xdg-open
which gnome-open >/dev/null && TOOL=gnome-open
which open >/dev/null && TOOL=open
URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1" URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
if [ -z "$TOOL" ]; then if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:" echo "Can't find a tool to open the URL:"
echo $URL echo $URL
else else
echo "Opening a New PR Form..." echo "Opening a New PR Form..."
"$TOOL" "$URL" "$OPEN" "$URL"
fi fi
[[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH [[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH

16
buildroot/share/git/mfpub

@ -77,15 +77,17 @@ else
git push -f origin git push -f origin
fi fi
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') which xdg-open >/dev/null && TOOL=xdg-open
which gnome-open >/dev/null && TOOL=gnome-open
which open >/dev/null && TOOL=open
URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1" URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
if [ -z "$TOOL" ]; then if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:" echo "Can't find a tool to open the URL:"
echo $URL echo $URL
else else
echo "Opening a New PR Form..." echo "Opening a New PR Form..."
"$TOOL" "$URL" "$OPEN" "$URL"
fi fi
fi fi
@ -116,14 +118,16 @@ git checkout gh-pages || { echo "Something went wrong!"; exit 1; }
rsync -av ${TMPFOLDER}/ ./ rsync -av ${TMPFOLDER}/ ./
opensite() { opensite() {
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') which xdg-open >/dev/null && TOOL=xdg-open
which gnome-open >/dev/null && TOOL=gnome-open
which open >/dev/null && TOOL=open
URL="http://marlinfw.org/" URL="http://marlinfw.org/"
if [ -z "$TOOL" ]; then if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:" echo "Can't find a tool to open the URL:"
echo $URL echo $URL
else else
echo "Opening the site in the browser..." echo "Opening the site in the browser..."
"$TOOL" "$URL" "$OPEN" "$URL"
fi fi
} }

Loading…
Cancel
Save