|
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
4 | 4 | import chalk from "chalk"; |
5 | | -import { checkLegacyConfigs, checkShellConfigs } from "../utils/shell.js"; |
| 5 | +import { checkLegacyConfigs, checkShellConfigPlugin, checkShellConfigs } from "../utils/shell.js"; |
6 | 6 |
|
7 | 7 | export const render = async () => { |
8 | 8 | let errors = 0; |
9 | 9 | errors += await renderLegacyConfigIssues(); |
| 10 | + errors += await renderShellPluginIssues(); |
10 | 11 | errors += renderShellConfigIssues(); |
11 | 12 |
|
12 | 13 | process.exit(errors); |
@@ -44,3 +45,31 @@ const renderShellConfigIssues = (): number => { |
44 | 45 | } |
45 | 46 | return 0; |
46 | 47 | }; |
| 48 | + |
| 49 | +const renderShellPluginIssues = async (): Promise<number> => { |
| 50 | + const { shellsWithoutPlugin, shellsWithBadPlugin } = await checkShellConfigPlugin(); |
| 51 | + if (shellsWithoutPlugin.length == 0) { |
| 52 | + process.stdout.write(chalk.green("✓") + " all shells have plugins\n"); |
| 53 | + } else { |
| 54 | + process.stderr.write(chalk.red("•") + " the following shells do not have the plugin installed:\n"); |
| 55 | + shellsWithoutPlugin.forEach((shell) => { |
| 56 | + process.stderr.write(chalk.red(" - ") + shell + "\n"); |
| 57 | + }); |
| 58 | + process.stderr.write(chalk.yellow(" review the README to generate the missing shell plugins, this warning can be ignored if you prefer manual startup\n")); |
| 59 | + } |
| 60 | + |
| 61 | + if (shellsWithBadPlugin.length == 0) { |
| 62 | + process.stdout.write(chalk.green("✓") + " all shells have correct plugins\n"); |
| 63 | + } else { |
| 64 | + process.stderr.write(chalk.red("•") + " the following shells have plugins incorrectly installed:\n"); |
| 65 | + shellsWithBadPlugin.forEach((shell) => { |
| 66 | + process.stderr.write(chalk.red(" - ") + shell + "\n"); |
| 67 | + }); |
| 68 | + process.stderr.write(chalk.yellow(" remove and regenerate the plugins according to the README, only whitespace can be after the shell plugins\n")); |
| 69 | + } |
| 70 | + |
| 71 | + if (shellsWithoutPlugin.length > 0 || shellsWithBadPlugin.length > 0) { |
| 72 | + return 1; |
| 73 | + } |
| 74 | + return 0; |
| 75 | +}; |
0 commit comments