Skip to content

Commit a6f751f

Browse files
authored
Merge pull request #23 from m-messiah/version
Add -version flag
2 parents 5335585 + 2b31e50 commit a6f751f

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ before_install:
99
- cpanm --local-lib=~/perl5 --quiet local::lib
1010
- eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
1111
- cpanm --local-lib=~/perl5 --quiet --notest Test::Nginx::Socket
12+
- echo "const VERSION = \"${TRAVIS_BRANCH}\"" >> version.go
1213
script:
1314
- go build -o ip2geo
15+
- ./ip2geo -version
1416
- ./ip2geo
1517
- TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo.t
1618
- ./ip2geo -lang en -nobase64

app.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ func main() {
2323
maxmindNoCountry := flag.Bool("nocountry", false, "do not add maxmind country maps")
2424
quiet := flag.Bool("q", false, "Be quiet - skip [OK]")
2525
veryQuiet := flag.Bool("qq", false, "Be very quiet - show only errors")
26+
version := flag.Bool("version", false, "Print version information and exit")
2627
flag.Parse()
28+
if *version {
29+
printMessage("ip2geo", "version "+VERSION, "OK")
30+
return
31+
}
2732
if !(*ipgeobase || *tor || *maxmind || *ip2proxyFlag) {
2833
// By default, generate all maps
2934
*ipgeobase = true

version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package main

0 commit comments

Comments
 (0)