summaryrefslogtreecommitdiff
path: root/src/parse-opt.ts
blob: 031b1a6fe2051097125b1ebccd62586086baff9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import * as nopt from 'nopt';

export default (vector, index) => {
	const parsed = nopt({
		'only-processor': Boolean,
		'only-server': Boolean
	}, {
		p: ['--only-processor'],
		s: ['--only-server']
	}, vector, index);

	if (parsed['only-processor'] && parsed['only-server']) {
		throw 'only-processor option and only-server option cannot be set at the same time';
	}

	return parsed;
};