Add a verbose mode

This commit is contained in:
Jeroen Engels 2021-10-01 23:10:59 +02:00
parent 09027a3834
commit 6e36e78637

View File

@ -23,12 +23,13 @@ Give me an Elm file, I'll compile it behind the scenes using Elm 0.19.1, and the
.usage('[options] <src/Main.elm>')
.option('--output <output>', 'the javascript file to create.', 'elm.js')
.option('-O3, --optimize-speed', 'Enable optimizations that likely increases asset size', false)
.option('--verbose', 'Show more error details, useful to provide better bug reports', false)
// .option('--init-benchmark <dir>', 'Generate some files to help run benchmarks')
// .option('--benchmark <dir>', 'Run the benchmark in the given directory.')
// .option('--replacements <dir>', 'Replace stuff')
.parse(process.argv);
const { output, optimizeSpeed } = program.opts();
const { output, optimizeSpeed, verbose } = program.opts();
run(
{
inputFilePath: program.args[0],
@ -37,6 +38,10 @@ run(
},
console.log.bind(console),
).catch((e) => {
console.error(e.toString());
if (verbose) {
console.error(e);
} else {
console.error(e.toString());
}
process.exit(1);
});