Skip to content

Commit

Permalink
cmd: better error messages when using stdin/stdout in combination wit…
Browse files Browse the repository at this point in the history
…h --recursive or --bundle
  • Loading branch information
tdewolff committed Jul 31, 2023
1 parent e87a716 commit 65bbd3b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmd/minify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,25 @@ func run() int {
}
}

if (useStdin || output == "") && (watch || sync || recursive) {
if (useStdin || output == "") && (watch || sync) {
if watch {
Error.Println("--watch doesn't work on stdin and stdout, specify input and output")
Error.Println("--watch doesn't work with stdin and stdout, specify input and output")
}
if sync {
Error.Println("--sync doesn't work on stdin and stdout, specify input and output")
Error.Println("--sync doesn't work with stdin and stdout, specify input and output")
}
return 1
} else if useStdin && (bundle || recursive) {
if bundle {
Error.Println("--bundle doesn't work with stdin, specify input")
}
if recursive {
Error.Println("--recursive doesn't work on stdin and stdout, specify input and output")
Error.Println("--recursive doesn't work with stdin, specify input")
}
return 1
} else if output == "" && recursive && !bundle {
Error.Println("--recursive doesn't work with stdout, specify output or use --bundle")
return 1
}
if mimetype == "" && useStdin {
Error.Println("must specify --mime or --type for stdin")
Expand Down

0 comments on commit 65bbd3b

Please sign in to comment.