use of org.jboss.galleon.diff.FsDiff.PathResolver in project galleon by wildfly.
the class GetChangesCommand method runCommand.
@Override
protected void runCommand(PmCommandInvocation invoc) throws CommandExecutionException {
try {
ProvisioningManager mgr = getManager(invoc.getPmSession());
FsDiff diff = mgr.getFsDiff();
if (diff.isEmpty()) {
invoc.println("No changes detected");
} else {
Path workingDir = Paths.get(invoc.getConfiguration().getAeshContext().getCurrentWorkingDirectory().getAbsolutePath());
Path installation = mgr.getInstallationHome();
PathResolver resolver = new PathResolver() {
@Override
public String resolve(String relativePath) {
Path absPath = Paths.get(installation.toString(), relativePath);
return workingDir.relativize(absPath).toString();
}
};
FsDiff.log(diff, new Consumer<String>() {
@Override
public void accept(String msg) {
invoc.println(msg);
}
}, resolver);
}
} catch (ProvisioningException ex) {
throw new CommandExecutionException(ex.getMessage());
}
}
Aggregations