|
|
@@ -2,16 +2,21 @@ package main |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.as/captureas/go-captureas" |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"os" |
|
|
|
) |
|
|
|
|
|
|
|
func main() { |
|
|
|
if len(os.Args) < 2 { |
|
|
|
w := flag.Int("w", 800, "Desired width of the screenshot") |
|
|
|
h := flag.Int("h", 600, "Desired height of the screenshot") |
|
|
|
flag.Parse() |
|
|
|
|
|
|
|
if len(flag.Args()) < 1 { |
|
|
|
fmt.Println("usage: cap [url]") |
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
url := os.Args[1] |
|
|
|
url := flag.Args()[0] |
|
|
|
|
|
|
|
username := os.Getenv("CAPTUREAS_USER") |
|
|
|
secret := os.Getenv("CAPTUREAS_SECRET") |
|
|
@@ -28,7 +33,7 @@ func main() { |
|
|
|
c := captureas.NewClient(username, secret) |
|
|
|
fmt.Println(c.Capture(&captureas.CaptureParams{ |
|
|
|
URL: url, |
|
|
|
Width: 800, |
|
|
|
Height: 600, |
|
|
|
Width: *w, |
|
|
|
Height: *h, |
|
|
|
})) |
|
|
|
} |