Take care not to proceed when user is just setting telemetry

This commit is contained in:
David Siegel 2018-03-21 09:16:42 -07:00
Родитель 54598cc420
Коммит 9697bd75bc
1 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -770,10 +770,22 @@ export async function main(args: string[] | Partial<CLIOptions>) {
cliOptions = inferCLIOptions(args);
}
if (cliOptions.telemetry === "enable") {
telemetry.enable();
} else if (cliOptions.telemetry === "disable") {
telemetry.disable();
if (cliOptions.telemetry !== undefined) {
switch (cliOptions.telemetry) {
case "enable":
telemetry.enable();
break;
case "disable":
telemetry.disable();
break;
default:
console.error(chalk.red("telemetry must be 'enable' or 'disable'"));
return;
}
if (Array.isArray(args) && args.length === 2) {
// This was merely a CLI run to set telemetry and we should not proceed
return;
}
}
const quicktypeOptions = await makeQuicktypeOptions(cliOptions);