return 0;
}
@Override
public RestoreOperationOptions parseOptions(String[] operationArgs) throws Exception {
RestoreOperationOptions operationOptions = new RestoreOperationOptions();
OptionParser parser = new OptionParser();
parser.allowsUnrecognizedOptions();
OptionSpec<Integer> optionRevision = parser.acceptsAll(asList("r", "revision")).withRequiredArg().ofType(Integer.class);
OptionSpec<String> optionTarget = parser.acceptsAll(asList("t", "target")).withRequiredArg().ofType(String.class);
OptionSet options = parser.parse(operationArgs);
// --revision=<n>
if (options.has(optionRevision)) {
operationOptions.setFileVersion(options.valueOf(optionRevision));
}
// --target=<file>
if (options.has(optionTarget)) {
operationOptions.setRelativeTargetPath(options.valueOf(optionTarget));
}
// <file-history-id>
List<?> nonOptionArgs = options.nonOptionArguments();
if (nonOptionArgs.size() != 1) {
throw new Exception("Invalid Syntax: File history ID must be specified.");
}
FileHistoryId restoreFileHistory = FileHistoryId.parseFileId(nonOptionArgs.get(0).toString());
operationOptions.setFileHistoryId(restoreFileHistory);
return operationOptions;
}