re1ro / grunt-bg-shell

Better shell commands for grunt
MIT License
50 stars 8 forks source link

Passing comment to the command! #3

Closed DKunin closed 11 years ago

DKunin commented 11 years ago

Hi there, first of all - great work! I cannot imagine how I lived without it.

Quick question, say I want to automate my git commits - how can I pass a comment to the task?

Thanks in advance!

re1ro commented 11 years ago

Hey! Where do you want to pass your comment from? From command line or from some automated interface?

Could you please explain me what exactly are you trying to do and how exactly do you want it to work. And I'll implement it

DKunin commented 11 years ago

Hi there! Thanks for reply. What I want to do is the following - I want to call grunt command - "grunt pusher" for example, with a comment, perhaps like - "grunt pusher: Added some refactoring staff", and then I want to run series of commands- like git pull, gut add -A, then I want to commit with the comment I entered earlier, and then call git push, and after that for example some more grunt action like grunt bumb, to update package.json.

Thank you in advance!

re1ro commented 11 years ago

Hey. Look how you can do it.

$ grunt commit --message="Commit message goes here"

Gruntfile:

var message = grunt.option('message') || '';

grunt.initConfig({
  bgShell: {
    commit: {
     cmd: 'git commit -m "' + message +'"',
    }
  }
});

grunt.registerTask('commit', ['bgShell:commit']);

Documentation

Please let me know if it works for you

Cheers

DKunin commented 11 years ago

Oops, didn't read the documentation too carefully!

Thanks a lot - that is exactly what I needed!