Parse nps args before calling function.
Closed this issue · 2 comments
Mehuge commented
At present, nps-plus passes input directly to the script. It would be better if input was pre-parsed, so that args are passed as a second args parameter, with the input being just the script name. The function signature for a function as script would therefore be
function something(name, args) {
...
}
Mehuge commented
Fixed in release 1.0.2 https://github.com/Mehuge/nps-plus/tree/1.0.2
Mehuge commented
Example:
module.exports = {
scripts: {
wait: 'task1 "sleep 1000" task2',
sleep: (scriptName, args) => new Promise((resolve, reject) => {
setTimeout(resolve, args[0] | 0)
})
}
};