shithub: rc

ref: ce7c66bff42a5073a334915fda1f70398747828c
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^'	'^$"*