shithub: pointless

ref: 5ca9e05549445b6f3ddb8f73dba423a083bbbde3
dir: /generate/

View raw version
#!/bin/rc

rfork en

fn usage {
	aux/usage
	exit usage
}

args='dir'
flagfmt='o:outdir outdir'

if(! eval `{aux/getflags $*})
	usage

if(~ $#outdir 0)
	outdir=`{pwd}^/out

if(! ~ $#* 1)
	usage

mkdir -p $outdir
dircp $1 $outdir

@ {
	cd $outdir
	pointlessroot=`{pwd}
}

for(index in `{walk $outdir | grep 'index\.rc$'}) @{
	cd `{basename -d $index}
	. index.rc
	rm index.rc
}

for(ptless in `{walk $outdir | grep '\.ptless$'}) @{
	cd `{basename -d $ptless}
	ptless=`{basename $ptless}
	pointless/pointless.awk $ptless >`{echo $ptless | sed 's@\.ptless$@.html@'}
	rm $ptless
}

for(epilogue in `{walk $outdir | grep 'epilogue\.rc$'}) @{
	cd `{basename -d $epilogue}
	. epilogue.rc
	rm epilogue.rc
}