Add ui messages about updating or installing each plugin using pgm init

Add plugin name to existing message prompting the user to overwrite it
or not; confusing otherwise. Simplify that message by removing the
redundant 'version' word.

Such messages are only for non-batch mode so far by design.

Change-Id: I31a1460ec74db841fe3a3e5f7986c8d8cea890aa
This commit is contained in:
Marco Miller
2016-04-12 13:55:53 -04:00
parent da1ad0cfbd
commit 27fe4c28a2

View File

@@ -130,9 +130,8 @@ public class InitPlugins implements InitStep {
if (upgrade) {
final String installedPluginVersion = getVersion(p);
if (!ui.yesno(upgrade,
"version %s is already installed, overwrite it",
installedPluginVersion)) {
if (!ui.yesno(upgrade, "%s %s is already installed, overwrite it",
plugin.name, installedPluginVersion)) {
Files.deleteIfExists(tmpPlugin);
continue;
}
@@ -145,6 +144,12 @@ public class InitPlugins implements InitStep {
}
try {
Files.move(tmpPlugin, p);
if (upgrade) {
// or update that is not an upgrade
ui.message("Updated %s to %s\n", plugin.name, plugin.version);
} else {
ui.message("Installed %s %s\n", plugin.name, plugin.version);
}
} catch (IOException e) {
throw new IOException("Failed to install plugin " + pluginName
+ ": " + tmpPlugin.toAbsolutePath() + " -> "