Browse Source

Patch up OPEN command in git scripts

Scott Lahteine 4 years ago
parent
commit
b82c0978cc
4 changed files with 25 additions and 15 deletions
  1. 5
    3
      buildroot/share/git/firstpush
  2. 5
    3
      buildroot/share/git/mfdoc
  3. 5
    3
      buildroot/share/git/mfpr
  4. 10
    6
      buildroot/share/git/mfpub

+ 5
- 3
buildroot/share/git/firstpush View File

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

+ 5
- 3
buildroot/share/git/mfdoc View File

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

+ 5
- 3
buildroot/share/git/mfpr View File

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

+ 10
- 6
buildroot/share/git/mfpub View File

@@ -77,15 +77,17 @@ else
77 77
     git push -f origin
78 78
   fi
79 79
 
80
-  TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
80
+  which xdg-open >/dev/null && TOOL=xdg-open
81
+  which gnome-open >/dev/null && TOOL=gnome-open
82
+  which open >/dev/null && TOOL=open
81 83
   URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
82 84
 
83
-  if [ -z "$TOOL" ]; then
85
+  if [ -z "$OPEN" ]; then
84 86
     echo "Can't find a tool to open the URL:"
85 87
     echo $URL
86 88
   else
87 89
     echo "Opening a New PR Form..."
88
-    "$TOOL" "$URL"
90
+    "$OPEN" "$URL"
89 91
   fi
90 92
 
91 93
 fi
@@ -116,14 +118,16 @@ git checkout gh-pages || { echo "Something went wrong!"; exit 1; }
116 118
 rsync -av ${TMPFOLDER}/ ./
117 119
 
118 120
 opensite() {
119
-  TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
121
+  which xdg-open >/dev/null && TOOL=xdg-open
122
+  which gnome-open >/dev/null && TOOL=gnome-open
123
+  which open >/dev/null && TOOL=open
120 124
   URL="http://marlinfw.org/"
121
-  if [ -z "$TOOL" ]; then
125
+  if [ -z "$OPEN" ]; then
122 126
     echo "Can't find a tool to open the URL:"
123 127
     echo $URL
124 128
   else
125 129
     echo "Opening the site in the browser..."
126
-    "$TOOL" "$URL"
130
+    "$OPEN" "$URL"
127 131
   fi
128 132
 }
129 133
 

Loading…
Cancel
Save