summaryrefslogtreecommitdiff
path: root/etc/functions/gtd-all
blob: ddbfdba88e201bd24b1f92e6539b04ca06e6f672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## vim:ft=zsh
## concatenate all GTD databases
## usage: gtd-all [--force] [devtodo options]
typeset prefix=~/var/gtd
typeset database
typeset -i force

while [[ $1 == -* ]] {
	case $1 in
		-|--) shift; break ;;
		--force) force=1 ;;
	esac
	shift
}

function gtd_grep {
	if (( force )) {
		cat
		return 0
	}
	if [[ -r ~/var/tmp/.actual-location && $(<~/var/tmp/.actual-location) == offline ]] {
		fgrep -v '@online'
		return 0
	}
	cat
	return 0
}

for database in $prefix/*(.N); {
	echo "\n${database:t}"
	todo --database $database $* | gtd_grep
}