-
Notifications
You must be signed in to change notification settings - Fork 1
/
revgeoc
executable file
·58 lines (47 loc) · 1.04 KB
/
revgeoc
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# revgeoc -- a client for revgeod
# see https://github.com/jpmens/revgeod
#
# Copyright (C) 2018-2019 Jan-Piet Mens <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
curl=curl
opts="-sSf"
opts="${opts} ${revgeo_verbose:+-i}"
host=${REVGEO_HOST:="127.0.0.1"}
port=${REVGEO_PORT:=8865}
case $1 in
dump|-d|-D)
q=dump
;;
stats|-s|version)
q=stats
;;
lookup)
if [ -z "$2" ]; then
echo "$0: lookup needs a geohash"
exit 2
fi
q="lookup?geohash=$2"
;;
kill)
if [ -z "$2" ]; then
echo "$0: kill needs a geohash"
exit 2
fi
q="kill?geohash=$2"
;;
test)
q="rev?lat=48.85593&lon=2.29431&app=revgeoc"
;;
test-mx)
q="rev?lat=21.434299&lon=-87.3369650000&app=revgeoc"
;;
*)
echo "Usage: $0 [test|test-mx|stats|dump|lookup|kill]" >&2
exit 2
esac
$curl $opts "http://$host:$port/$q" && echo