|
- package main
-
- import (
- "code.as/captureas/go-captureas"
- "flag"
- "fmt"
- "os"
- )
-
- func main() {
- 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 := flag.Args()[0]
-
- username := os.Getenv("CAPTUREAS_USER")
- secret := os.Getenv("CAPTUREAS_SECRET")
- if username == "" {
- fmt.Println("CAPTUREAS_USER not set.")
- }
- if secret == "" {
- fmt.Println("CAPTUREAS_SECRET not set.")
- }
- if username == "" || secret == "" {
- os.Exit(1)
- }
-
- c := captureas.NewClient(username, secret)
- fmt.Println(c.Capture(&captureas.CaptureParams{
- URL: url,
- Width: *w,
- Height: *h,
- }))
- }
|