shithub: zet

ref: 44efe644d6962daaf2f299560633221fd43abcc3
dir: /zlstag/

View raw version
#!/bin/rc -e

rfork en
dir=`{basename -d `{src -n $0}}
. $dir/zlib

if(~ $1 '') {
	echo usage: $0 tag
	exit usage
}

tag=$1

files=()

tagsplit=' 	,
'

for(f in *.txt) {
	tags=`$tagsplit{ztag $f}
	for(t in $tags) {
		if(~ $"t $"tag)
			files=($files $f)
	}
}

if(! test -f /mnt/acme/index) {
	zlist $files
	exit
}
wd=`{pwd}
cd /mnt/acme/new
echo name $wd/-Zettelkasten >ctl
@{cd $wd; zlist $files} >data
echo scratch >ctl
echo nomenu >ctl
echo nomark >ctl
echo clean >ctl