Patch up OPEN command in git scripts

This commit is contained in:
Scott Lahteine 2019-10-01 22:03:59 -05:00
parent d0ef7b6588
commit b82c0978cc
4 changed files with 25 additions and 15 deletions

View file

@ -16,13 +16,15 @@ BRANCH=${INFO[5]}
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"
if [ -z "$TOOL" ]; then
if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:"
echo $URL
else
echo "Viewing commits on $BRANCH..."
"$TOOL" "$URL"
"$OPEN" "$URL"
fi

View file

@ -16,14 +16,16 @@ BRANCH=${INFO[5]}
[[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; }
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/"
if [ -z "$TOOL" ]; then
if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:"
echo $URL
else
echo "Opening preview site in the browser..."
"$TOOL" "$URL"
"$OPEN" "$URL"
fi
}

View file

@ -23,15 +23,17 @@ OLDBRANCH=${INFO[5]}
# See if it's been pushed yet
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"
if [ -z "$TOOL" ]; then
if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:"
echo $URL
else
echo "Opening a New PR Form..."
"$TOOL" "$URL"
"$OPEN" "$URL"
fi
[[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH

View file

@ -77,15 +77,17 @@ else
git push -f origin
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"
if [ -z "$TOOL" ]; then
if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:"
echo $URL
else
echo "Opening a New PR Form..."
"$TOOL" "$URL"
"$OPEN" "$URL"
fi
fi
@ -116,14 +118,16 @@ git checkout gh-pages || { echo "Something went wrong!"; exit 1; }
rsync -av ${TMPFOLDER}/ ./
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/"
if [ -z "$TOOL" ]; then
if [ -z "$OPEN" ]; then
echo "Can't find a tool to open the URL:"
echo $URL
else
echo "Opening the site in the browser..."
"$TOOL" "$URL"
"$OPEN" "$URL"
fi
}