Closed vladikoff closed 8 years ago
This behavior is expected with grunt@1.0.0
. See the release notes regarding nopt
: http://gruntjs.com/blog/2016-02-11-grunt-1.0.0-rc1-released#api-changes
The new syntax should be grunt --gruntfile=some/path/Gruntfile.js
.
@shama yeah this is tricky ...
@vladikoff
In new versions of nopt
, unknown options by default have true
as value. See npm/nopt#16 for reference.
Also, from their README
:
$ node my-program.js --blatzk -fp # unknown opts are ok.
{ blatzk: true, flag: true, pick: true }
$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value
{ blatzk: 1000, flag: true, pick: true }
$ node my-program.js --no-blatzk -fp # unless they start with "no-"
{ blatzk: false, flag: true, pick: true }
To fix that and maintain compatibility with older cli version, you can add gruntfile
and base
to known options, without forgetting the base
alias -b
:
// CLI options we care about.
exports.known = {help: Boolean, version: Boolean, completion: String, gruntfile: String, base: String};
exports.aliases = {b: '--base', h: '--help', V: '--version', v: '--verbose'};
Yea @shama has more detail on this but basically we dropped backwards compat
Ah, thanks :) Somehow I missed the new release.
Oh sorry I wasn't aware of this behavior in nopt
(thank you @Arkni!). If we can provide backwards compatibility for the known grunt options through the regular API of the latest version of nopt
I think we should.
Here are the options Grunt knows about: https://github.com/gruntjs/grunt/blob/master/lib/grunt/cli.js#L33
@vladikoff I can look into this along with the bin issue this evening.
There is an issue in the update to latest nopt.
Ref: https://github.com/gruntjs/grunt-cli/issues/101