Skip to content

Commit e7b7ec3

Browse files
committed
feat(cli): add --yes
1 parent 65ee423 commit e7b7ec3

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

bin/cmd.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const cli = meow(`
1010
Options
1111
--help Show help
1212
--yarn Use yarn for installing
13+
--yes Pass --yes all for install process
1314
1415
Examples
1516
$ create-textlint-rule awesome-rule

lib/scripts/create-textlint-rule.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const chalk = require('chalk');
1313
*/
1414
module.exports = function(ruleName, options = {}) {
1515
const useYarn = options.yarn !== undefined;
16+
const useYes = options.yes !== undefined;
1617
const cwd = process.cwd();
1718
const ruleDir = path.join(cwd, ruleName);
1819
return spawn(`git`, [
@@ -36,7 +37,7 @@ module.exports = function(ruleName, options = {}) {
3637
}).then(() => {
3738
console.log(chalk.green(`Input information about your textlint rule`));
3839
return spawn("npm",
39-
["init"],
40+
["init"].concat(useYes ? ["--yes"] : []),
4041
{stdio: 'inherit'});
4142
}).then(() => {
4243
console.log(chalk.green(`Wait... Installing npm packages for development`));

test/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ declare currentDir=$(cd $(dirname $0);pwd)
44
declare dirName=$(basename "${currentDir}")
55
declare parentDir=$(dirname "${currentDir}")
66
declare testRuleName="test-rule-name";
7-
87
# test
98
cd ${currentDir}
10-
yes "" | head -10 | node ${parentDir}/bin/cmd.js "${testRuleName}"
9+
node ${parentDir}/bin/cmd.js "${testRuleName}" --yes
1110
rm -rf "${currentDir}/textlint-rule-${testRuleName}"

0 commit comments

Comments
 (0)