Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Aug 5, 2019
1 parent 0d5a185 commit 7343d9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const path = require('path');

const chalk = require('chalk');

const pkg = require('../package.json');

const availableActions = templates => {
const generators = L.filter(fs.readdirSync(templates), _ => fs.lstatSync(path.join(templates, _)).isDirectory());
return L.reduce(generators, (acc, generator) => {
Expand All @@ -18,6 +20,7 @@ const availableActions = templates => {
};

const printHelp = (templates, logger) => {
logger.log(`Hygen v${pkg.version}`);
logger.log('\nAvailable actions:');

if (!templates) {
Expand All @@ -42,7 +45,7 @@ const printHelp = (templates, logger) => {
}

L.each(availableActions(templates), (v, k) => {
logger.log(chalk.bold(k) + ': ' + v.join(', '));
logger.log(`${chalk.bold(k)}: ${v.join(', ')}`);
});
};

Expand Down
9 changes: 5 additions & 4 deletions lib/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ function () {
subaction = _L$split2[1];

const actionfolder = path.join(templates, generator, mainAction);
const promptArgs = yield prompt(createPrompter, actionfolder, L.omit(argv, ['_']));
const cleanArgs = Object.assign(L.omit(argv, ['_']), name && {
name
});
const promptArgs = yield prompt(createPrompter, actionfolder, cleanArgs);
const args = Object.assign({
templates,
actionfolder,
generator,
action,
subaction
}, promptArgs, L.omit(argv, ['_']), name && {
name
});
}, promptArgs, cleanArgs);
return args;
});

Expand Down
3 changes: 2 additions & 1 deletion lib/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const prompt = (createPrompter, actionfolder, args) => {
});
}

return prompter.prompt(hooksModule);
return prompter.prompt( // prompt _only_ for things we've not seen on the CLI
hooksModule.filter(p => args[p.name] === undefined || args[p.name] === null || args[p.name].length === 0));
};

module.exports = prompt;

0 comments on commit 7343d9d

Please sign in to comment.