Skip to content

Commit

Permalink
Merge pull request #136 from anithri/cli-help
Browse files Browse the repository at this point in the history
add usage msg
  • Loading branch information
jondot authored Aug 8, 2019
2 parents 49d6343 + 0df49ec commit cb82e84
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ const params = require('./params')

const engine = async (
argv: Array<string>,
config: RunnerConfig
config: RunnerConfig,
): Promise<Array<ActionResult>> => {
const { cwd, templates, logger } = config
const args = Object.assign(await params(config, argv), { cwd })
const { generator, action, actionfolder } = args

if (['-h', '--help'].includes(argv[0])) {
logger.log(`
Usage:
hygen [option] GENERATOR ACTION [--name NAME] [data-options]
Options:
-h, --help # Show this message and quit
--dry # Perform a dry run. Files will be generated but not saved.`)
process.exit(0)
}

logger.log(args.dry ? '(dry mode)' : '')
if (!generator) {
throw new Error('please specify a generator.')
Expand Down

0 comments on commit cb82e84

Please sign in to comment.