Files
archived-nodemon/lib/config/command.js
Remy Sharp 2a2f1260e4 If no script, default is null, not -1. Fixes #265
Includes test and exposing the command run for debugging.
2014-01-21 07:57:27 +00:00

28 lines
646 B
JavaScript

'use strict';
module.exports = command;
function command(options) {
var executable = options.execOptions.exec,
args = [];
// after "executable" go the exec args (like --debug, etc)
if (options.execOptions.execArgs) {
[].push.apply(args, options.execOptions.execArgs);
}
// then goes the user's script arguments
if (options.args) {
[].push.apply(args, options.args);
}
// after the "executable" goes the user's script
if (options.script) {
args.splice((options.scriptPosition || 0) + options.execOptions.execArgs.length, 0, options.script);
}
return {
executable: executable,
args: args
};
}