Open cradbold opened 7 years ago
Indeed, https://gruntjs.com/api/grunt.option says:
Note that boolean options can be specified using just a key without a value. For example, running
grunt deploy --staging
on the command line would causegrunt.option('staging')
to return true.
I tried to reproduce the issue you face a number of different ways, but it seems to work fine:
// Gruntfile.js
module.exports = function(grunt) {
console.log(grunt.option.flags());
}
grunt v1.0.2 (released 2018):
$ npx grunt --version
grunt-cli v1.2.0
grunt v1.0.4
$ npx grunt --foo --bar
[ '--foo', '--bar' ]
$ npx grunt quux --foo --bar
[ '--foo', '--bar' ]
And on a more recent version:
$ npx grunt --version
grunt-cli v1.4.3
grunt v1.6.1
$ npx grunt --foo --bar
[ '--foo', '--bar', '--gruntfile=/gruntjs.com/Gruntfile.js' ]
$ npx grunt quux --foo --bar
[ '--foo', '--bar', '--gruntfile=/gruntjs.com/Gruntfile.js' ]
... but it doesn't appear that you do: