2017-05-03 15:35:00 +02:00
|
|
|
'use strict';
|
|
|
|
module.exports = function (flag, argv) {
|
|
|
|
argv = argv || process.argv;
|
|
|
|
|
|
|
|
var terminatorPos = argv.indexOf('--');
|
2017-08-14 05:01:11 +02:00
|
|
|
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
|
2017-05-03 15:35:00 +02:00
|
|
|
var pos = argv.indexOf(prefix + flag);
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
2017-05-03 15:35:00 +02:00
|
|
|
};
|