我在文档中四处寻找,我不认为这是可能的,但我真的希望我的grunt plugin的api更容易......
答案 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:in
和grunt clock:out
。
否则,如果您绝对更喜欢grunt clock in
,则需要自己解析process.argv
。