use of org.syncany.operations.down.DownOperationOptions in project syncany by syncany.
the class DownCommand method parseOptions.
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;
}
use of org.syncany.operations.down.DownOperationOptions in project syncany by syncany.
the class DownCommand method execute.
@Override
public int execute(String[] operationArgs) throws Exception {
DownOperationOptions operationOptions = parseOptions(operationArgs);
DownOperationResult operationResult = new DownOperation(config, operationOptions).execute();
printResults(operationResult);
return 0;
}
Aggregations