0
我環顧四周的文檔,我不認爲這是可能的,但我真的很喜歡我的grunt plugin api更容易...「grunt clock in」而不是「grunt clock --in」< - 可能嗎?
我環顧四周的文檔,我不認爲這是可能的,但我真的很喜歡我的grunt plugin api更容易...「grunt clock in」而不是「grunt clock --in」< - 可能嗎?
我會使任務單任務,只是使用參數:
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
。
我知道你可以,但我從來沒有這樣做過......沒有關於它的文檔?你也可以這樣做:'grunt clock:in'並通過handler函數中的'this.args'獲得額外的位。我知道,不一樣。 – jakerella
哦,其實,看起來你可能有一個重複的...這是你在找什麼? http://stackoverflow.com/questions/13351932/gruntjs-command-line-arguments – jakerella