mirror of
https://git.sr.ht/~adnano/go-gemini
synced 2024-11-23 08:32:02 +01:00
examples/client: Add optional host argument
This commit is contained in:
parent
77486c2d8a
commit
004d76265e
@ -152,8 +152,19 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var host string
|
||||
if len(os.Args) >= 3 {
|
||||
host = os.Args[2]
|
||||
}
|
||||
|
||||
url := os.Args[1]
|
||||
req, err := gmi.NewRequest(url)
|
||||
var req *gmi.Request
|
||||
var err error
|
||||
if host != "" {
|
||||
req, err = gmi.NewRequestTo(url, host)
|
||||
} else {
|
||||
req, err = gmi.NewRequest(url)
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user