Skip to content

Commit

Permalink
fix: do not print section titles if no need
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jan 10, 2025
1 parent ebf90f6 commit 86eb11c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/cli-plugin-extensions/src/downloadAndLinkExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ export const downloadAndLinkExtension = async ({
}
}

console.log();
console.log(chalk.bold("Next Steps"));
nextStepsToDisplay.forEach(({ text, variables = [] }) => {
console.log(`‣ ${text}`, ...variables.map(v => context.success.hl(v)));
});
if (nextStepsToDisplay.length) {
console.log();
console.log(chalk.bold("Next Steps"));
nextStepsToDisplay.forEach(({ text, variables = [] }) => {
console.log(`‣ ${text}`, ...variables.map(v => context.success.hl(v)));
});
}

// Additional Notes section.
const additionalNotesToDisplay: ExtensionMessage[] = [
Expand All @@ -203,11 +205,13 @@ export const downloadAndLinkExtension = async ({
}
}

console.log();
console.log(chalk.bold("Additional Notes"));
additionalNotesToDisplay.forEach(({ text, variables = [] }) => {
console.log(`‣ ${text}`, ...variables.map(v => context.success.hl(v)));
});
if (additionalNotesToDisplay.length) {
console.log();
console.log(chalk.bold("Additional Notes"));
additionalNotesToDisplay.forEach(({ text, variables = [] }) => {
console.log(`‣ ${text}`, ...variables.map(v => context.success.hl(v)));
});
}
} catch (e) {
switch (e.code) {
case "NO_OBJECTS_FOUND":
Expand Down

0 comments on commit 86eb11c

Please sign in to comment.