Use demandOption instead of explicit checks of args
Summary: `yargs` supports this Reviewed By: passy Differential Revision: D33812132 fbshipit-source-id: d7846222f140fc32035824fe035737ae9ae2780e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
85d1b060c7
commit
be451e15d9
@@ -36,14 +36,17 @@ const argv = yargs
|
|||||||
device: {
|
device: {
|
||||||
describe: 'The device name or serial/udid to listen to',
|
describe: 'The device name or serial/udid to listen to',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
demandOption: true,
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
||||||
describe: 'The application name to listen to',
|
describe: 'The application name to listen to',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
demandOption: true,
|
||||||
},
|
},
|
||||||
plugin: {
|
plugin: {
|
||||||
describe: 'Plugin id to listen to',
|
describe: 'Plugin id to listen to',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
demandOption: true,
|
||||||
},
|
},
|
||||||
// TODO: support filtering events
|
// TODO: support filtering events
|
||||||
// TODO: support verbose mode
|
// TODO: support verbose mode
|
||||||
@@ -254,18 +257,6 @@ function createLogger(): Logger {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!argv.device) {
|
|
||||||
console.error('--device not specified');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
if (!argv.client) {
|
|
||||||
console.error('--client not specified');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
if (!argv.plugin) {
|
|
||||||
console.error('--plugin not specified');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
start(argv.device!, argv.client!, argv.plugin!).catch((e) => {
|
start(argv.device!, argv.client!, argv.plugin!).catch((e) => {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user