diff --git a/src/bin.ts b/src/bin.ts index 0cbfc67..9d088fe 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -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] ') .option('--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 ', 'Generate some files to help run benchmarks') // .option('--benchmark ', 'Run the benchmark in the given directory.') // .option('--replacements ', '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); });