Skip to content

Commit

Permalink
Argument validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dacamp committed Jun 1, 2016
1 parent a44fb72 commit 30dc818
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"image"
"os"
"time"
Expand Down Expand Up @@ -45,6 +46,12 @@ func draw(img image.Image) {
}

func main() {
if len(os.Args) != 2 {
fmt.Printf("Usage: %s <filename>\n\n", os.Args[0])
fmt.Println("Close the image with <ESC>.")
os.Exit(1)
}

img, err := load(os.Args[len(os.Args)-1])
if err != nil {
panic(err)
Expand Down

0 comments on commit 30dc818

Please sign in to comment.