Skip to content

Instantly share code, notes, and snippets.

@masiuchi
Last active November 19, 2017 06:26
Show Gist options
  • Save masiuchi/347b5474b091af2115a36a09fbf2bff0 to your computer and use it in GitHub Desktop.
Save masiuchi/347b5474b091af2115a36a09fbf2bff0 to your computer and use it in GitHub Desktop.
Open GitHub, Travis CI and CircleCI of current repository.
#!/bin/sh
github() {
git remote get-url origin \
| perl -pe 'if (s|^git@||) { s|\.git$||; s|:|/|; s|^(.)|https://$1| }' \
| xargs open
}
travis() {
git remote get-url origin \
| perl -pe 's|^git\@github\.com:||; s|\.git$||; s|^(.)|https://travis-ci.org/$1|' \
| xargs open
}
circleci() {
git remote get-url origin \
| perl -pe 's|^git\@github\.com:||; s|\.git$||; s|^(.)|https://circleci\.com/gh/$1|' \
| xargs open
}
SUBCOMMAND=$1
if [ "$SUBCOMMAND" = "travis" ]; then
travis
elif [ "$SUBCOMMAND" = "circleci" ]; then
circleci
else
github
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment