From 65bbd3b7bcef06d21fac1af6a0ef7ff70a49800a Mon Sep 17 00:00:00 2001 From: Taco de Wolff Date: Mon, 31 Jul 2023 11:23:25 +0200 Subject: [PATCH] cmd: better error messages when using stdin/stdout in combination with --recursive or --bundle --- cmd/minify/main.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/minify/main.go b/cmd/minify/main.go index d8bd443075..64f2bcd8ad 100644 --- a/cmd/minify/main.go +++ b/cmd/minify/main.go @@ -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")