public DownOperationOptions parseOptions(String[] operationArguments) { DownOperationOptions operationOptions = new DownOperationOptions(); OptionParser parser = new OptionParser(); parser.allowsUnrecognizedOptions(); OptionSpec<String> optionConflictStrategy = parser.acceptsAll(asList("C", "conflict-strategy")).withRequiredArg(); OptionSpec<Void> optionNoApply = parser.acceptsAll(asList("A", "no-apply")); OptionSet options = parser.parse(operationArguments); // --conflict-strategy=<strategy> if (options.has(optionConflictStrategy)) { String conflictStrategyStr = options.valueOf(optionConflictStrategy).toUpperCase(); operationOptions.setConflictStrategy(DownConflictStrategy.valueOf(conflictStrategyStr)); } // --no-apply if (options.has(optionNoApply)) { operationOptions.setApplyChanges(false); } return operationOptions; }