Fix plugin installation output and error handling in registerPluginCommands
This commit is contained in:
@@ -174,19 +174,23 @@ export function registerPluginCommands(program: Command): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (ctx.json) {
|
if (ctx.json) {
|
||||||
printOutput(plugin, { json: true });
|
printOutput(installedPlugin, { json: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin) {
|
if (!installedPlugin) {
|
||||||
console.log(pc.dim("Install returned no plugin record."));
|
console.log(pc.dim("Install returned no plugin record."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(pc.green(`✓ Installed ${pc.bold(plugin.pluginKey)} v${plugin.version} (${plugin.status})`));
|
console.log(
|
||||||
|
pc.green(
|
||||||
|
`✓ Installed ${pc.bold(installedPlugin.pluginKey)} v${installedPlugin.version} (${installedPlugin.status})`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if (plugin.lastError) {
|
if (installedPlugin.lastError) {
|
||||||
console.log(pc.red(` Warning: ${plugin.lastError}`));
|
console.log(pc.red(` Warning: ${installedPlugin.lastError}`));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
handleCommandError(err);
|
handleCommandError(err);
|
||||||
@@ -312,7 +316,6 @@ export function registerPluginCommands(program: Command): void {
|
|||||||
console.log(pc.red(`Plugin not found: ${pluginKey}`));
|
console.log(pc.red(`Plugin not found: ${pluginKey}`));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
console.log(formatPlugin(result));
|
console.log(formatPlugin(result));
|
||||||
if (result.lastError) {
|
if (result.lastError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user