mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-25 22:50:42 +03:00
Get help information from arguments
This commit is contained in:
parent
07dd5d2fe9
commit
89100d5ae9
@ -38,6 +38,7 @@ run(
|
||||
verbose,
|
||||
processOpts: { stdio: ['inherit', 'ignore', 'inherit'] },
|
||||
},
|
||||
program.helpInformation(),
|
||||
console.log.bind(console),
|
||||
).catch((e) => {
|
||||
if (verbose) {
|
||||
|
@ -14,6 +14,7 @@ export async function run(options: {
|
||||
verbose: false,
|
||||
processOpts: options.processOpts || { stdio: ['inherit', 'ignore', 'inherit'] },
|
||||
},
|
||||
'',
|
||||
() => { }
|
||||
);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
// tslint:disable-next-line no-require-imports no-var-requires
|
||||
import program from 'commander';
|
||||
import * as path from 'path';
|
||||
import * as Transform from './transform';
|
||||
import { toolDefaults } from './types';
|
||||
@ -17,6 +16,7 @@ export async function run(
|
||||
verbose: boolean,
|
||||
processOpts: { stdio: [string, string, string] },
|
||||
},
|
||||
helpInformation: string,
|
||||
log: (message?: any, ...optionalParams: any[]) => void
|
||||
) {
|
||||
if (!options.outputFilePath) {
|
||||
@ -85,7 +85,7 @@ export async function run(
|
||||
throw new Error('An error occurred when compiling your application with Elm 0.19.1.');
|
||||
}
|
||||
} else {
|
||||
throw new Error('Please provide a path to an Elm file.\n' + program.helpInformation());
|
||||
throw new Error(`Please provide a path to an Elm file.\n${helpInformation}`.trim());
|
||||
}
|
||||
if (jsSource != '') {
|
||||
const transformed = await Transform.transform(
|
||||
|
Loading…
Reference in New Issue
Block a user