2024-09-18 08:27:46 -07:00
|
|
|
'use strict';
|
2024-11-04 11:06:36 -08:00
|
|
|
|
|
|
|
module.exports = (flag, argv = process.argv) => {
|
2024-09-18 08:27:46 -07:00
|
|
|
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
2024-11-04 11:06:36 -08:00
|
|
|
const position = argv.indexOf(prefix + flag);
|
|
|
|
const terminatorPosition = argv.indexOf('--');
|
|
|
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
2024-09-18 08:27:46 -07:00
|
|
|
};
|