Skip to content

Commit fa3769f

Browse files
author
Jozef Reisinger
committed
replace -s flag with -i
1 parent a61a5d5 commit fa3769f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

cmd/checkip.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/jreisinger/checkip"
1111
)
1212

13-
var s = flag.Bool("s", false, "only print how many checkers consider the ipaddr suspicious")
13+
var i = flag.Bool("i", false, "run only information checkers")
1414

1515
func main() {
1616
flag.Parse()
@@ -47,19 +47,12 @@ func main() {
4747
"net.IP": &checkip.IP{},
4848
}
4949

50-
if *s {
51-
var checkerSlice []checkip.Checker
52-
for _, v := range checkers {
53-
checkerSlice = append(checkerSlice, v)
54-
}
55-
n := checkip.Run(checkerSlice, ipaddr)
56-
perc := float64(n) / float64(len(checkers)) * 100.0
57-
fmt.Printf("%02.0f%% (%d/%d)\n", perc, n, len(checkers))
50+
if *i {
51+
checkers = infoCheckers
5852
} else {
5953
for k, v := range infoCheckers {
6054
checkers[k] = v
6155
}
62-
checkip.RunAndPrint(checkers, ipaddr, "%-25s %s")
6356
}
64-
57+
checkip.RunAndPrint(checkers, ipaddr, "%-25s %s")
6558
}

0 commit comments

Comments
 (0)