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