Skip to content

Commit

Permalink
Merge pull request #8 from calavera/verbose
Browse files Browse the repository at this point in the history
Make the program more verbose with a flag.
  • Loading branch information
syohex authored Sep 23, 2016
2 parents 13c9467 + b1b7880 commit 78cb394
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/byzanz-window/byzanz-window.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type byzanzArg struct {
cursor bool
audio bool
output string
verbose bool
}

var xRe = regexp.MustCompile(`Absolute upper-left X:\s*(\d+)`)
Expand Down Expand Up @@ -230,6 +231,10 @@ func record(arg *byzanzArg) error {
cmdArgs = append(cmdArgs, `-a`)
}

if arg.verbose {
cmdArgs = append(cmdArgs, `-v`)
}

cmdArgs = append(cmdArgs,
`-x`, strconv.Itoa(arg.x),
`-y`, strconv.Itoa(arg.y),
Expand All @@ -241,6 +246,9 @@ func record(arg *byzanzArg) error {
)

cmd := exec.Command(`byzanz-record`, cmdArgs...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout

if err := cmd.Start(); err != nil {
return err
}
Expand Down Expand Up @@ -276,6 +284,7 @@ func main() {
audio := flag.BoolP("audio", "a", false, "Record audio")
rect := flag.BoolP("rectangle", "r", false, "Record specified rectangle")
version := flag.BoolP("version", "v", false, "Show version")
verbose := flag.BoolP("verbose", "V", false, "Make the output verbose")
flag.Parse()

if *version {
Expand Down Expand Up @@ -321,6 +330,7 @@ func main() {
arg.cursor = *cursor
arg.audio = *audio
arg.output = outputGif
arg.verbose = *verbose

if err := record(arg); err != nil {
fmt.Fprintln(os.Stderr, err)
Expand Down

0 comments on commit 78cb394

Please sign in to comment.