shithub: pointless

ref: 88702036dd2a9a54247dc2729bd8dcb9141f8867
dir: /generate/

View raw version
#!/bin/rc -e

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

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.awk $ptless >`{echo $ptless | sed 's@\[email protected]@'}
	rm $ptless
}