wm: infra

ref: 9f833900ad0a9bef9743dccddd01b31fd6dc2fe9
dir: /doc/ps/

View raw version
#!/bin/rc -e

. /sys/lib/shithub/common.rc

cd $1
shift

rfork ne
nl='
'

gituser=$1
repo=$2
refname=$3
file=$4

repons $gituser $repo
if(! ref=`{resolveref $refname}){
	echo 'Invalid ref '$refname''
	exit
}

if(! test -d $gitfs/$ref/tree){
	echo 'No such document'
	exit
}

cd $gitfs/$ref/tree
if(test -r $gitfs/$ref/tree/$file.wms)
	wm/doc/wiki2ms $gitfs/$ref/tree/$file.wms | troff -ms | dpost
if not
	troff -ms $gitfs/$ref/tree/$file.ms | dpost