use of org.jboss.galleon.cli.cmd.maingrp.CheckUpdatesCommand.Updates in project galleon by wildfly.
the class UpdateCommand method doRunCommand.
@Override
protected void doRunCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException {
try {
ProvisioningManager mgr = getManager(session);
Updates updates = CheckUpdatesCommand.getUpdatesTable(mgr, session, allDependencies(), getFP());
if (updates.plan.isEmpty()) {
session.println(UP_TO_DATE);
} else {
session.println(UPDATES_AVAILABLE);
session.println(updates.t.build());
if (!noConfirm()) {
try {
Key k = null;
while (k == null || (!Key.y.equals(k) && !Key.n.equals(k))) {
session.print("Proceed with latest updates [y/n]?");
KeyAction a = session.input();
k = Key.findStartKey(a.buffer().array());
}
if (Key.n.equals(k)) {
return;
}
} finally {
session.println("");
}
}
mgr.apply(updates.plan, options);
}
} catch (ProvisioningException | IOException ex) {
throw new CommandExecutionException(session.getPmSession(), CliErrors.updateFailed(), ex);
} catch (InterruptedException ignored) {
// Just exit the command smoothly
}
}
Aggregations