aboutsummaryrefslogtreecommitdiff
path: root/tools/horizonget
blob: 8aa930842a72a1692ced892b5a4c21c71c6e3d11 (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
#!/bin/rc
rfork ne
cwd=`{basename -d $0}
center='@sun'
target=()
t0=`{date -f 'YYYY-MM-DD' `{echo `{date -n} - 86400 | bc}}
t1=`{date -f 'YYYY-MM-DD'}
step='1 d'
flagfmt=''
args='target [t0 t1]'

fn usage {
	aux/usage
	exit usage
}

if(! ifs=() eval `{aux/getflags $*})
	usage

switch($#*){
case 1
	target=$1
case 3
	target=$1
	t0=$2
	t1=$3
case *
	usage
}

$cwd^/horizon.api.get $center $target $t0 $t1 $step | $cwd^/horizon.getdata.awk | tr A-Z a-z