File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,17 @@ if [ -z "$BUILDKITE_ORGANIZATION" -o -z "$BUILDKITE_PIPELINE" ]; then
175175 exit 1
176176fi
177177
178+ # Parse flags before parsing arguments
179+ let i=1
180+ while [[ $i -le $# ]]; do
181+ case " ${! i} " in
182+ " --browse" )
183+ browse=yes
184+ shift $i
185+ esac
186+ let i=i+1
187+ done
188+
178189if [[ " $# " -eq 0 ]]; then
179190 if ! current_branch_exists; then
180191 echo " Woops, you don't seem to be on a branch." >&2
@@ -359,3 +370,13 @@ echo
359370echo " ${build_url} "
360371echo
361372
373+ # Open a browser if we can
374+ if [[ -n " $browse " ]]; then
375+ if which open > /dev/null 2>&1 ; then
376+ open " ${build_url} "
377+ elif which xdg-open > /dev/null 2>&1 ; then
378+ xdg-open " ${build_url} "
379+ else
380+ echo " Sorry but I don't know how to open your browser! Copy and paste the link above as you like."
381+ fi
382+ fi
You can’t perform that action at this time.
0 commit comments