shithub: rc

ref: 7eadf4cdfa03b8b93c86924dd25cd3dddc78418f
dir: /bin/repoadd/

View raw version
#!/bin/rc -e
rfork ne
fn usage{
	echo usage: $0 '[-u user] REPO [DESC..]' >[1=2]
	exit usage
}

root=/sys/lib/extra
repodir=usr
user=()
while(~ $1 -?){
	switch($1){
	case -u
		user=$2
		shift 2
	case *
		usage
	}
}
if(~ $#* 0)
	usage
repo=(`{echo $1 | sed 's,.*/([^/]+)/([^/]+)/?$,\1 \2,'})
url=$1
shift
if(~ $#user 0)
	user=$repo(1)
repo=$repo(2)
dir=$root/$repodir/$user

git/clone $url $dir/$repo
echo $url^'	'^$user/^$repo^'	'^$dir/$repo^'	'^$"*