Fix arguments parsing for Grunt ~0.4.x
npm install nopt-grunt-fixnopt and fix the options parsing. But since it's a breaking change it's not going to be implemented until Grunt 0.5.0...
bash
$ npm install --save nopt-grunt-fix
`
Usage
At the top of your Gruntfile.js:
`javascript
module.exports = function(grunt){
require('nopt-grunt-fix')(grunt);
//...
}
`
That's it!
Behaviour
Without nopt-grunt-fix, running:
`bash
$ grunt task1 --no-build --once --no-watch -r=1.10
`
will give you:
`javascript
grunt.option('no-build') === true ✓
grunt.option('once') === '--no-watch' ✗
grunt.option('r') === 1.1 ✗
grunt.option('no-watch') === false ✗
grunt.option('watch') === undefined ✗
`
__With__ nopt-grunt-fix, running:
`bash
$ grunt task1 --no-build --once --no-watch -r=1.10
`
will give you:
`javascript
grunt.option('no-build') === true ✓
grunt.option('once') === true ✓
grunt.option('r') === '1.10' ✓
grunt.option('no-watch') === true ✓
grunt.option('watch') === false ✓
`
Debugging
If you run Grunt with the --debug flag then we'll log out the old and new flags:
`
[D] (nopt-grunt-fix) old flags: [ '--no-build', '--once=--no-watch', '--r=1.1', '--debug=1' ]
[D] (nopt-grunt-fix) new flags: [ '--no-build', '--once', '--r=1.10', '--debug=1', '--no-watch' ]
``