hlfw.ca

task

ref: 95ef1b2259790e01c9dda588eeabb67e884df834
dir: /rm/

View raw version
#!/bin/rc -e
rfork ne

fn checkstate {
	if(! ~ $#all 0){
		if(! ~ $#force 0)
			rmlist=`{ls .task}
		if not {
			rmlist=`{task/walk -t -fD}
		}
	}
	if not {
		if(! ~ $#force 0)
			rmlist=`{ls .task/$tag}
		if not
			rmlist=`{task/walk -t -fD}
	}
	if(~ $#rmlist 0){
		echo 'no tag' >[1=2]
		exit 'tag'
	}
}

fn rmtask {
	for(m in $rmlist){
		echo $m completed
		#rm $m
	}
}

flagfmt='f:force, a:all'; args='tag'
eval `''{aux/getflags $*} || exec aux/usage
rmlist=()
tag=$1
@{
	flag e +
	checkstate
	rmtask
} || echo 'could not rm task:' $status >[1=2]
exit ''