Introduce processor
This commit is contained in:
17
src/parse-opt.ts
Normal file
17
src/parse-opt.ts
Normal file
@ -0,0 +1,17 @@
|
||||
const nopt = require('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;
|
||||
};
|
Reference in New Issue
Block a user