UNPKG

619 BJavaScriptView Raw
1#!/usr/bin/env node
2import { format } from 'node:util';
3
4import { CommanderError, program } from 'commander';
5
6import * as app from './dist/esm/app.mjs';
7
8app.run(program, process.argv).catch((e) => {
9 if (!(e instanceof CommanderError) && !(e instanceof app.CheckFailed)) {
10 const msg = e instanceof app.ApplicationError ? e.message : format(e);
11 process.stdout.write(msg + '\n');
12 // It is possible an explicit exit code was set, use it if it was.
13 process.exitCode = process.exitCode || 1;
14 }
15 if (e instanceof app.CheckFailed) {
16 process.exitCode = e.exitCode;
17 }
18});