“grunt clock in”而不是“grunt clock --in”< - 可能吗?

时间:2014-01-12 06:23:17

标签: node.js gruntjs command-line-interface

我在文档中四处寻找,我不认为这是可能的,但我真的希望我的grunt plugin的api更容易......

1 个答案:

答案 0 :(得分:0)

我会将任务作为一项任务,只使用参数:

grunt.registerTask('clock', function(which) {
  if (which === 'in') {
    /* clock in */
  } else if (which === 'out') {
    /* clock out */
  } else {
    grunt.log.error('I have no idea what that means');
  }
});

然后你可以grunt clock:ingrunt clock:out

否则,如果您绝对更喜欢grunt clock in,则需要自己解析process.argv