Skip to content

Commit

Permalink
check for directory
Browse files Browse the repository at this point in the history
  • Loading branch information
raspi committed Dec 30, 2019
1 parent 4a98dcb commit 005bf56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func getParams() (source iface.ReadSeekerCloser, displays []iface.CharacterForma
} else {
// Read file
if len(remaining) != 1 {
fmt.Fprintln(os.Stderr, fmt.Sprintf(`error: no file given as argument, see --help `))
fmt.Fprintln(os.Stderr, fmt.Sprintf(`error: no file given as argument, see --help`))
os.Exit(1)
}

Expand All @@ -114,6 +114,11 @@ func getParams() (source iface.ReadSeekerCloser, displays []iface.CharacterForma
os.Exit(1)
}

if fi.IsDir() {
fmt.Fprintln(os.Stderr, fmt.Sprintf(`error: %v is directory`, fpath))
os.Exit(1)
}

startOffset := int64(*startOffsetS)

if startOffset != 0 {
Expand Down

0 comments on commit 005bf56

Please sign in to comment.