-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
31 lines (28 loc) · 844 Bytes
/
main.go
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
package main
import (
"flag"
"fmt"
"github.com/lucasmelin/dinosaur/dino"
"github.com/lucasmelin/dinosaur/dns"
)
func main() {
var meteor = flag.Bool("meteor", false, "disable the dino ascii art (default false)")
var impatient = flag.Bool("impatient", false, "do not wait for an input between each frame (default false)")
flag.Parse()
args := flag.Args()
url := "www.lucasmelin.com"
if len(args) != 0 {
url = args[0]
}
if !*meteor {
d := dino.NewDino()
d.SayLeft(fmt.Sprintf("I wonder how I can reach %s", url))
fmt.Println("\nPress any key to continue the journey...")
_, _ = fmt.Scanln()
ipAddress := string(dns.AsciiResolve(url, "A", *impatient))
d.SayLeft(fmt.Sprintf("Great, now I know I can reach %s at %s", url, ipAddress))
} else {
ipAddress := string(dns.Resolve(url, "A"))
fmt.Println(ipAddress)
}
}