()
| 67 | } |
| 68 | |
| 69 | function main() { |
| 70 | try { |
| 71 | const options = parseArgs(process.argv); |
| 72 | if (options.help) { |
| 73 | showHelp(0); |
| 74 | } |
| 75 | |
| 76 | const result = repairInstalledStates({ |
| 77 | repoRoot: require('path').join(__dirname, '..'), |
| 78 | homeDir: process.env.HOME || os.homedir(), |
| 79 | projectRoot: process.cwd(), |
| 80 | targets: options.targets, |
| 81 | dryRun: options.dryRun, |
| 82 | }); |
| 83 | const hasErrors = result.summary.errorCount > 0; |
| 84 | |
| 85 | if (options.json) { |
| 86 | console.log(JSON.stringify(result, null, 2)); |
| 87 | } else { |
| 88 | printHuman(result); |
| 89 | } |
| 90 | |
| 91 | process.exitCode = hasErrors ? 1 : 0; |
| 92 | } catch (error) { |
| 93 | console.error(`Error: ${error.message}`); |
| 94 | process.exit(1); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | main(); |
no test coverage detected