Skip to content

Commit

Permalink
fix(cli): fix passing dashargs to rules without preceeding --
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Sep 20, 2018
1 parent 7ab7efa commit 2a36927
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
29 changes: 17 additions & 12 deletions src/Promake.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,26 @@ Tasks:
this.rule(lastTarget).args.push(argv[i].replace(/^--(-+)$/, '$1'))
}
} else if (argv[i].startsWith('-')) {
switch (argv[i]) {
case '--':
if (lastTarget) {
if (lastTarget) {
if (argv[i] === '--') {
this.rule(lastTarget).args = []
ruleArgsMode = true
} else {
this.rule(lastTarget).args.push(argv[i])
}
} else {
switch (argv[i]) {
case '-q':
case '--quiet':
this.verbosity = Verbosity.QUIET
break
case '-v':
case '--verbose':
this.verbosity = Verbosity.HIGH
break
default:
throw new Error(`unrecognized option: ${argv[i]}`)
}
break
case '-q':
case '--quiet':
this.verbosity = Verbosity.QUIET
break
case '-v':
case '--verbose':
this.verbosity = Verbosity.HIGH
break
}
} else {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ describe('Promake', () => {
task('bar', bar, rule => barArgs = rule.args)

await cli([
'node', 'promake.js', '--',
'node', 'promake.js',
'foo', '--', 'a', '----', 'b', '--',
'bar', '--', 'c', 'd'
], {exit: false})
Expand Down

0 comments on commit 2a36927

Please sign in to comment.