File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 22
33set -e
44
5+ # import dependency
6+ parentPath=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; pwd -P )
7+ . " $parentPath /os-open"
8+
59commitSHA=$1
610test -z " $commitSHA " && echo " Please provide SHA string of a commit." 1>&2 && exit 1
711
812gitUserAndProject=" $( git config --get remote.origin.url | cut -d : -f 2 | cut -d . -f 1) "
913
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 22
33set -e
44
5+ # import dependency
6+ parentPath=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; pwd -P )
7+ . " $parentPath /os-open"
8+
59filePath=$1
610test -z " $filePath " && echo " Please provide file path to open." 1>&2 && exit 1
711
812gitUserAndProject=" $( git config --get remote.origin.url | cut -d : -f 2 | cut -d . -f 1) "
913mainBranch=" $( cat .git/refs/remotes/origin/HEAD | cut -d ' /' -f 4) "
1014
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
22
33set -e
44
55# Check if params are enough to go ahead.
66baseBranch=$1
77featureBranch=$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
99test -z " $featureBranch " && echo " Please provide the name for feature branch." 1>&2 && exit 1
1010
1111# 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