Skip to content

Commit

Permalink
feat(cli): add --yes
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Dec 13, 2016
1 parent 65ee423 commit e7b7ec3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const cli = meow(`
Options
--help Show help
--yarn Use yarn for installing
--yes Pass --yes all for install process
Examples
$ create-textlint-rule awesome-rule
Expand Down
3 changes: 2 additions & 1 deletion lib/scripts/create-textlint-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const chalk = require('chalk');
*/
module.exports = function(ruleName, options = {}) {
const useYarn = options.yarn !== undefined;
const useYes = options.yes !== undefined;
const cwd = process.cwd();
const ruleDir = path.join(cwd, ruleName);
return spawn(`git`, [
Expand All @@ -36,7 +37,7 @@ module.exports = function(ruleName, options = {}) {
}).then(() => {
console.log(chalk.green(`Input information about your textlint rule`));
return spawn("npm",
["init"],
["init"].concat(useYes ? ["--yes"] : []),
{stdio: 'inherit'});
}).then(() => {
console.log(chalk.green(`Wait... Installing npm packages for development`));
Expand Down
3 changes: 1 addition & 2 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ declare currentDir=$(cd $(dirname $0);pwd)
declare dirName=$(basename "${currentDir}")
declare parentDir=$(dirname "${currentDir}")
declare testRuleName="test-rule-name";

# test
cd ${currentDir}
yes "" | head -10 | node ${parentDir}/bin/cmd.js "${testRuleName}"
node ${parentDir}/bin/cmd.js "${testRuleName}" --yes
rm -rf "${currentDir}/textlint-rule-${testRuleName}"

0 comments on commit e7b7ec3

Please sign in to comment.