in CommandLineClient/src/main/java/com/facebook/ads/injkit/cli/CommandDescription.java [36:91]
public static CommandDescription parse(String[] args) throws CliException {
File inputFile = null;
File outputFile = null;
File configFile = null;
List<File> classpath = new ArrayList<>();
for (int i = 0; i < args.length; i++) {
ArgumentNameAndValue argumentNameAndValue = parseArgument(args[i]);
switch (argumentNameAndValue.getName()) {
case INPUT_COMMAND:
if (inputFile != null) {
throw new CliException("'%s' argument specified more than once", INPUT_COMMAND);
}
inputFile = new File(argumentNameAndValue.getValue());
break;
case OUTPUT_COMMAND:
if (outputFile != null) {
throw new CliException("'%s' argument specified more than once", OUTPUT_COMMAND);
}
outputFile = new File(argumentNameAndValue.getValue());
break;
case CONFIG_COMMAND:
if (configFile != null) {
throw new CliException("'%s' argument specified more than once", CONFIG_COMMAND);
}
configFile = new File(argumentNameAndValue.getValue());
break;
case CLASSPATH_COMMAND:
for (String element :
argumentNameAndValue.getValue().split(System.getProperty("path.separator"))) {
classpath.add(new File(element));
}
break;
default:
throw new CliException("Unknown argument '%s'", argumentNameAndValue.getName());
}
}
if (inputFile == null) {
throw new CliException("'%s' argument not specified", INPUT_COMMAND);
}
if (outputFile == null) {
throw new CliException("'%s' argument not specified", OUTPUT_COMMAND);
}
if (configFile == null) {
throw new CliException("'%s' argument not specified", CONFIG_COMMAND);
}
return new CommandDescription(inputFile, outputFile, configFile, classpath);
}