s-ol / git-goodbye Goto Github PK
View Code? Open in Web Editor NEWa post-update hook for saying goodbye to GitHub
a post-update hook for saying goodbye to GitHub
I really suck at sh, this is how far I got:
#!/bin/sh
set -e
panic() {
>&2 echo "$1"
exit 2
}
while [[ $# -gt 0 ]]; do
arg="$1"
shift
case $arg in
--branch)
CREATE_BRANCH=true
;;
--push)
PUSH=true
;;
--ALL)
CREATE_BRANCH=true
PUSH=true
;;
*)
cat 1>&2 <<EOF
error: unknown option '$arg'.
USAGE: #{arg[0]} [<options>]
OPTIONS:
--branch: create a new orphan branch
--push: push new orphan branch
--all: all of the above"
EOF
exit 1
;;
esac
done
if [ -n "$PUSH" ] && [ -z "$CREATE_BRANCH" ]; then
panic "--push is pointless without --branch"
fi
USER_RE="s\-ol"
NEW_REMOTE_RE="git\.s\-ol.nu"
NEW_SLUG_RE=".*git\.s\-ol.nu[:/]public/(.*)"
NEW_HTTP="git.s-ol.nu"
REMOTES=$(git remote -v)
TMP=$(git remote -v | grep "github\.com[:/]$GITHUB_USER_RE.*(push)$" | awk '{print $1 " " $2}')
read OLD_REMOTE OLD_URL <<<$TMP
# not working yet:
OLD_SLUG=$(sed -E "s|.*github\.com[:/]($GITHUB_USER_RE/.*)|\1|" <<<$OLD_URL)
TMP=$(git remote -v | grep "$NEW_REMOTE_RE.*(push)$" | awk '{print $1 " " $2}')
read NEW_REMOTE NEW_URL <<<$TMP
# not working yet:
NEW_SLUG=$(sed -E "s|$NEW_SLUG_RE$|\1|" <<<$NEW_URL)
echo "moving github.com/$OLD_SLUG [$OLD_REMOTE] -> $NEW_HTTP/$NEW_SLUG [$NEW_REMOTE]"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.