grunt, grunt-shell and command argument

arguments, gruntjs

Solution

Your problem is the alias, aliases don't work like you think.

If you use

grunt shell:hello:me

Then it'll work the way you expect it to.

Since aliases can be a list of zero or more tasks, it wouldn't make sense for them to pass parameters to other classes. If you want to alias it so badly, then the best you can hope for is creating another task to do the aliasing, rather than a real alias.

grunt.registerTask('d', function (greeting) {
  grunt.task.run('shell:hello:' + greeting);
});

In that case then you would be able to do what you intended, using

grunt d:me

Problem

I would like to pass an argument to `grunt-shell` like it is defined in the documentation: ``` module.exports = function(grunt) { // Configure Grunt grunt.initConfig({ shell: { hello: { command: function (greeting) { return 'echo ' + greeting; }, options: { stdout: true } } } }); grunt.loadNpmTasks('grunt-shell'); grunt.registerTask('d', 'shell:hello'); ``` When I execute it without argument it's working but when I try to put an argument I got an error: ``` Julio:Server julio$ grunt d Running "shell:hello" (shell) task undefined Done, without errors. Julio:Server julio$ grunt d:me Warning: Task "me" not found. Use --force to continue. Aborted due to warnings. ``` Where is my misunderstanding? Thank you

Original source