Browse Source

Support -w and -h flags

These set the desired width and height of the thumbnail, respectively.
master
Matt Baer 5 years ago
parent
commit
22b14eac58
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      main.go

+ 9
- 4
main.go View File

@@ -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,
}))
}

Loading…
Cancel
Save