Skip to content

Commit

Permalink
feat(open-url): add support for opening a url across platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Deavon M. McCaffery committed Dec 28, 2016
1 parent d142880 commit 8509caa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/scripts/open-url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
open-url() {
local url="$1"

if [ -z "${1:-}" ]; then
echo "open-url: url must be supplied"
return 1
fi

for cmd in open gnome-open kde-open xdg-open sensible-browser; do
if type "$cmd" 1>/dev/null 2>&1; then
echo "opening $url via $cmd..."
"$cmd" "$url"
return 0
fi
done

return 1
}
3 changes: 3 additions & 0 deletions src/scripts/update-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function update-prompt() {
return 1
fi

local CHANGELOG_URI="https://github.com/pulsebridge/prompt/blob/master/CHANGELOG.md"
local UPDATE_URI="https://github.com/pulsebridge/prompt/archive/master.tar.gz"
local UPDATE_TEMP=$(mktemp -d -t pb_prompt)

Expand All @@ -24,4 +25,6 @@ function update-prompt() {
popd 1>/dev/null

rm -rf $UPDATE_TEMP 1>/dev/null

open-url $CHANGELOG_URI 1>/dev/null
}

0 comments on commit 8509caa

Please sign in to comment.