Skip to content

Commit d383bb2

Browse files
author
Kelly Selden
committed
use collect-unknown-options for initializing blueprints with options
1 parent 2ad0978 commit d383bb2

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

bin/commands/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports.handler = async function handler(argv) {
2020
let statsOnly = argv['stats-only'];
2121
let listCodemods = argv['list-codemods'];
2222
let createCustomDiff = argv['create-custom-diff'];
23-
let blueprintOptions = argv['--'] || [];
23+
let blueprintOptions = argv._.slice(0);
2424

2525
try {
2626
let message = await emberCliUpdate({

bin/commands/init.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ module.exports.builder = {
1414
reset: args['reset']
1515
};
1616

17-
module.exports.blueprintOptionsDefault = [];
18-
1917
module.exports.handler = async function handler(argv) {
2018
let blueprint = argv['blueprint'];
2119
let to = argv['to'];
2220
let resolveConflicts = argv['resolve-conflicts'];
2321
let reset = argv['reset'];
24-
let blueprintOptions = argv['--'] || module.exports.blueprintOptionsDefault;
22+
let blueprintOptions = argv._.slice(1);
2523

2624
try {
2725
let message = await init({

bin/commands/save.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports.builder = {
1515
module.exports.handler = async function handler(argv) {
1616
let blueprint = argv['blueprint'];
1717
let from = argv['from'];
18-
let blueprintOptions = argv['--'] || [];
18+
let blueprintOptions = argv._.slice(1);
1919

2020
try {
2121
await save({

bin/ember-cli-update.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
require('yargs')
55
.commandDir('commands')
66
.parserConfiguration({
7-
'populate--': true
7+
'populate--': true,
8+
'collect-unknown-options': true
89
})
910
.argv;
1011

src/init.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ const resolvePackage = require('./resolve-package');
1717
const {
1818
'to': { default: toDefault }
1919
} = require('./args');
20-
const {
21-
blueprintOptionsDefault
22-
} = require('../bin/commands/init');
2320

2421
module.exports = async function init({
2522
blueprint: _blueprint,
2623
to = toDefault,
2724
resolveConflicts,
2825
reset,
29-
blueprintOptions = blueprintOptionsDefault,
26+
blueprintOptions = [],
3027
wasRunAsExecutable
3128
}) {
3229
let cwd = process.cwd();

test/acceptance/ember-cli-update-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe(function() {
9292
if (from) {
9393
args.push(`--from=${from}`);
9494
}
95-
args = [...args, '--', ...blueprintOptions];
95+
args = [...args, ...blueprintOptions];
9696

9797
return processBin({
9898
binFile: 'ember-cli-update',
@@ -587,7 +587,6 @@ describe(function() {
587587
'save',
588588
`-b=${location}`,
589589
`--from=${partial}`,
590-
'--',
591590
...options
592591
],
593592
cwd: tmpPath,
@@ -640,7 +639,6 @@ describe(function() {
640639
`-b=${location}`,
641640
`--from=${from}`,
642641
`--to=${to}`,
643-
'--',
644642
...options
645643
],
646644
cwd: tmpPath,

0 commit comments

Comments
 (0)