Created
September 10, 2015 20:35
-
-
Save tribut/44c3710db0d8663fc0ed to your computer and use it in GitHub Desktop.
Create new repo for mr/vcsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
repourl="$1" | |
reponame="$(echo "$repourl" | sed -r 's#.*/([^.]+).git#\1#')" | |
status() { | |
echo "[vcsh-new] $@" >&2 | |
} | |
if [ "$repourl" = "$reponame" -o -n "$2" ]; then | |
status "Please call me like this: $0 [git-url]" | |
exit 1 | |
fi | |
mrdir="$HOME/.config/mr" | |
alldir="$mrdir/available.d" | |
actdir="$mrdir/config.d" | |
repdir=".config/vcsh/repo.d/$reponame.git" | |
status "Creating mr config $reponame.vcsh" | |
echo "[\$HOME/$repdir] | |
checkout = vcsh clone $repourl" > "$alldir/$reponame.vcsh" | |
status "Enabling new config" | |
ln -s "../available.d/$reponame.vcsh" "$actdir" | |
status "Registering new repo with mr" | |
vcsh mr add "$alldir/$reponame.vcsh" | |
vcsh mr add "$actdir/$reponame.vcsh" | |
status "Doing initial checkout" | |
mr -d "$HOME/$repdir" up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment