hlfw.ca

task

ref: f30683e38b8d611db965670be6c906e612458cd7
dir: /rm/

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

fn cleanlinks {
	# Walk through any related tags, and remove any blockable references
}

fn checkstate {
	if(! ~ $#all 0){
		if(! ~ $#force 0)
			rmlist=`{ls .task}
		if not {
			# TODO: This will need to be filtered to just our project after
			#rmlist=`{task/walk -c -fC -p $project}
			rmlist=`{task/walk -c -fC}
		}
	}
	if not {
		if(! ~ $#force 0)
			rmlist=`{ls .task/$tag}
		if not
			rmlist=`{task/walk -q fC $tag && ls .task/$tag}
	}
}

fn rmtask {
	for(m in $rmlist){
		# TODO: when we have multiproject
		#echo $project/$m completed
		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
	cleanlinks
} || echo 'could not rm task:' $status >[1=2]
exit ''