소스 검색

Patch up OPEN command in git scripts

Scott Lahteine 5 년 전
부모
커밋
b82c0978cc
4개의 변경된 파일25개의 추가작업 그리고 15개의 파일을 삭제
  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 파일 보기

16
 
16
 
17
 git push --set-upstream origin $BRANCH
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
 URL="https://github.com/$FORK/$REPO/commits/$BRANCH"
22
 URL="https://github.com/$FORK/$REPO/commits/$BRANCH"
21
 
23
 
22
-if [ -z "$TOOL" ]; then
24
+if [ -z "$OPEN" ]; then
23
   echo "Can't find a tool to open the URL:"
25
   echo "Can't find a tool to open the URL:"
24
   echo $URL
26
   echo $URL
25
 else
27
 else
26
   echo "Viewing commits on $BRANCH..."
28
   echo "Viewing commits on $BRANCH..."
27
-  "$TOOL" "$URL"
29
+  "$OPEN" "$URL"
28
 fi
30
 fi

+ 5
- 3
buildroot/share/git/mfdoc 파일 보기

16
 [[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; }
16
 [[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; }
17
 
17
 
18
 opensite() {
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
   URL="http://127.0.0.1:4000/"
22
   URL="http://127.0.0.1:4000/"
21
-  if [ -z "$TOOL" ]; then
23
+  if [ -z "$OPEN" ]; then
22
     echo "Can't find a tool to open the URL:"
24
     echo "Can't find a tool to open the URL:"
23
     echo $URL
25
     echo $URL
24
   else
26
   else
25
     echo "Opening preview site in the browser..."
27
     echo "Opening preview site in the browser..."
26
-    "$TOOL" "$URL"
28
+    "$OPEN" "$URL"
27
   fi
29
   fi
28
 }
30
 }
29
 
31
 

+ 5
- 3
buildroot/share/git/mfpr 파일 보기

23
 # See if it's been pushed yet
23
 # See if it's been pushed yet
24
 if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
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
 URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
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
   echo "Can't find a tool to open the URL:"
32
   echo "Can't find a tool to open the URL:"
31
   echo $URL
33
   echo $URL
32
 else
34
 else
33
   echo "Opening a New PR Form..."
35
   echo "Opening a New PR Form..."
34
-  "$TOOL" "$URL"
36
+  "$OPEN" "$URL"
35
 fi
37
 fi
36
 
38
 
37
 [[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH
39
 [[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH

+ 10
- 6
buildroot/share/git/mfpub 파일 보기

77
     git push -f origin
77
     git push -f origin
78
   fi
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
   URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
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
     echo "Can't find a tool to open the URL:"
86
     echo "Can't find a tool to open the URL:"
85
     echo $URL
87
     echo $URL
86
   else
88
   else
87
     echo "Opening a New PR Form..."
89
     echo "Opening a New PR Form..."
88
-    "$TOOL" "$URL"
90
+    "$OPEN" "$URL"
89
   fi
91
   fi
90
 
92
 
91
 fi
93
 fi
116
 rsync -av ${TMPFOLDER}/ ./
118
 rsync -av ${TMPFOLDER}/ ./
117
 
119
 
118
 opensite() {
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
   URL="http://marlinfw.org/"
124
   URL="http://marlinfw.org/"
121
-  if [ -z "$TOOL" ]; then
125
+  if [ -z "$OPEN" ]; then
122
     echo "Can't find a tool to open the URL:"
126
     echo "Can't find a tool to open the URL:"
123
     echo $URL
127
     echo $URL
124
   else
128
   else
125
     echo "Opening the site in the browser..."
129
     echo "Opening the site in the browser..."
126
-    "$TOOL" "$URL"
130
+    "$OPEN" "$URL"
127
   fi
131
   fi
128
 }
132
 }
129
 
133
 

Loading…
취소
저장