26 lines
314 B
Go
26 lines
314 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func usage() {
|
|
fmt.Printf("%s: url port[OPTIONAL]\n", os.Args[0])
|
|
}
|
|
|
|
func main() {
|
|
if len(os.Args) == 1 {
|
|
usage()
|
|
os.Exit(1)
|
|
}
|
|
if len(os.Args) == 2 {
|
|
//defualt port
|
|
Fetch(os.Args[1])
|
|
}
|
|
if len(os.Args) == 3 {
|
|
//custom port
|
|
Fetch(os.Args[1], os.Args[2])
|
|
}
|
|
}
|