summaryrefslogtreecommitdiff
path: root/sys/orgdresolv
blob: 59a2c4fe6103b0c753975ae68ae4601b58d3d637 (plain) (blame)
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
33
34
35
#!/bin/sh
# Resolve an environment path if not present. Pass the name of the path here 
# and it will output the path. 
# For instance: orgdresolv ORGD_ROOT will output "$HOME/docs/wr/orgd/"


# TODO: add all envvars.
# Also, probably best to recursively resolve. So if $ORGD_BIBCSV_PATH not 
# found, try $ORGD_KT_PATH/biblio.csv, if that envvar not found try 
# $ORGD_ROOT/kt/biblio.csv, etc etc

case $1 in 
	ORGD_ROOT) 
		[ -z "$ORGD_ROOT" ] && echo "$HOME/docs/wr/orgd" || echo "$ORGD_ROOT";;
	ORGD_KT_PATH) 
		[ -z "$ORGD_KT_PATH" ] && echo "$HOME/docs/wr/orgd/kt" || echo "$ORGD_KT_PATH";;
	ORGD_MED_PATH) 
		[ -z "$ORGD_MED_PATH" ] && echo "$HOME/docs/wr/orgd/med" || echo "$ORGD_MED_PATH";;
	ORGD_BIBCSV_PATH) 
		[ -z "$ORGD_BIBCSV_PATH" ] && echo "$HOME/docs/wr/orgd/kt/biblio.csv" || echo "$ORGD_BIBCSV_PATH";;
	ORGD_SD_PATH)
		[ -z "$ORGD_SD_PATH" ] && echo "$HOME/docs/wr/orgd/sd" || echo "$ORGD_SD_PATH";;
	ORGD_CDALIAS_PATH) 
		[ -z "$ORGD_CDALIAS_PATH" ] && echo "$HOME/docs/wr/orgd/sd/cd" || echo "$ORGD_CDALIAS_PATH";;
	ORGD_TD_PATH) 
		[ -z "$ORGD_TD_PATH" ] && echo "$HOME/docs/wr/orgd/td" || echo "$ORGD_TD_PATH";;
	ORGD_FIN_MONTHS) 
		[ -z "$ORGD_FIN_MONTHS" ] && echo "$HOME/docs/wr/trk/fin/ent" || echo "$ORGD_FIN_MONTHS";;
	ORGD_TRK_PATH)
		[ -z "$ORGD_TRK_PATH" ] && echo "$HOME/docs/wr/trk" || echo "$ORGD_TRK_PATH";;
	*)
		exit 1 ;; 
esac

exit 0