From 377bfe76fe10928b0fc37c50d0c94668af24f5da Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 22 Aug 2024 21:41:48 +0200 Subject: [PATCH] Error when the user puts options before the subcommand These will be silently ignored due to a bug in picocli (#833) --- src/main/java/com/crowdin/cli/Cli.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/crowdin/cli/Cli.java b/src/main/java/com/crowdin/cli/Cli.java index 920f8e0fd..111043775 100755 --- a/src/main/java/com/crowdin/cli/Cli.java +++ b/src/main/java/com/crowdin/cli/Cli.java @@ -9,6 +9,15 @@ public class Cli { public static void main(String[] args) { + // Workaround for a bug in picocli where valid options before the subcommand are ignored + for (String arg : args) { + if (!arg.startsWith("--")) { + break; + } + System.out.printf("Option %s needs to be after the subcommand\n", arg); + System.exit(1); + } + try { PicocliRunner picocliRunner = PicocliRunner.getInstance(); Actions actions = new CliActions();