File tree 4 files changed +23
-4
lines changed
4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
+ # import dependency
6
+ parentPath=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; pwd -P )
7
+ . " $parentPath /os-open"
8
+
5
9
commitSHA=$1
6
10
test -z " $commitSHA " && echo " Please provide SHA string of a commit." 1>&2 && exit 1
7
11
8
12
gitUserAndProject=" $( git config --get remote.origin.url | cut -d : -f 2 | cut -d . -f 1) "
9
13
10
- open " https://github.com/$gitUserAndProject /commit/$commitSHA "
14
+ $OS_OPEN " https://github.com/$gitUserAndProject /commit/$commitSHA "
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
+ # import dependency
6
+ parentPath=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; pwd -P )
7
+ . " $parentPath /os-open"
8
+
5
9
filePath=$1
6
10
test -z " $filePath " && echo " Please provide file path to open." 1>&2 && exit 1
7
11
8
12
gitUserAndProject=" $( git config --get remote.origin.url | cut -d : -f 2 | cut -d . -f 1) "
9
13
mainBranch=" $( cat .git/refs/remotes/origin/HEAD | cut -d ' /' -f 4) "
10
14
11
- open " https://github.com/$gitUserAndProject /blob/$mainBranch /$filePath "
15
+ $OS_OPEN " https://github.com/$gitUserAndProject /blob/$mainBranch /$filePath "
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
3
3
set -e
4
4
5
5
# Check if params are enough to go ahead.
6
6
baseBranch=$1
7
7
featureBranch=$2
8
- test -z " $baseBranch " && echo " Please provide the source base branch." 1>&2 && exit 1
8
+ test -z " $baseBranch " && echo " Please provide the base and feature branch." 1>&2 && exit 1
9
9
test -z " $featureBranch " && echo " Please provide the name for feature branch." 1>&2 && exit 1
10
10
11
11
# Find which is your current branch
Original file line number Diff line number Diff line change
1
+ # Found OS open utility and define it as OS_OPEN variable
2
+ LINUX_OPEN="$(command -v xdg-open)"
3
+ OSX_OPEN="$(command -v open)"
4
+ if [ -x $LINUX_OPEN ]; then
5
+ OS_OPEN=$LINUX_OPEN
6
+ elif [ -x $OSX_OPEN ]; then
7
+ OS_OPEN=$OSX_OPEN
8
+ else
9
+ echo 'No open utility found'
10
+ exit 1
11
+ fi
You can’t perform that action at this time.
0 commit comments