- try {
- if (args.length == 0)
- throw new IllegalArgumentException("At least an action must be provided");
- int actionIndex = 0;
- String action = args[actionIndex];
- if (args.length > actionIndex + 1 && !args[actionIndex + 1].startsWith("-"))
- throw new IllegalArgumentException(
- "Action " + action + " must be followed by an option: " + Arrays.asList(args));
-
- Map<String, List<String>> options = new HashMap<>();
- String currentOption = null;
- for (int i = actionIndex + 1; i < args.length; i++) {
- if (args[i].startsWith("-")) {
- currentOption = args[i];
- if (!options.containsKey(currentOption))
- options.put(currentOption, new ArrayList<>());
-
- } else {
- options.get(currentOption).add(args[i]);
- }
+ if (args.length == 0)
+ throw new IllegalArgumentException("At least an action must be provided");
+ int actionIndex = 0;
+ String action = args[actionIndex];
+ if (args.length > actionIndex + 1 && !args[actionIndex + 1].startsWith("-"))
+ throw new IllegalArgumentException(
+ "Action " + action + " must be followed by an option: " + Arrays.asList(args));
+
+ Map<String, List<String>> options = new HashMap<>();
+ String currentOption = null;
+ for (int i = actionIndex + 1; i < args.length; i++) {
+ if (args[i].startsWith("-")) {
+ currentOption = args[i];
+ if (!options.containsKey(currentOption))
+ options.put(currentOption, new ArrayList<>());
+
+ } else {
+ options.get(currentOption).add(args[i]);