-
Notifications
You must be signed in to change notification settings - Fork 652
Expand file tree
/
Copy pathtelemetry.js
More file actions
24 lines (22 loc) · 829 Bytes
/
Copy pathtelemetry.js
File metadata and controls
24 lines (22 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Thin delegate: forwards each `apos telemetry <sub>` to create-apostrophe.
// Commander supplies `--help` for the parent and each subcommand.
module.exports = function (program) {
const telemetry = program
.command('telemetry')
.description('Manage telemetry preference for ApostropheCMS CLI.');
for (const [ sub, summary ] of [
[ 'status', 'Show current telemetry preference.' ],
[ 'on', 'Opt in.' ],
[ 'off', 'Opt out.' ],
[ 'preview', 'Print the exact payload that would be sent.' ]
]) {
telemetry
.command(sub)
.description(summary)
.action(async function () {
const { runTelemetryCommand } = await import('create-apostrophe');
const code = await runTelemetryCommand({ sub });
process.exit(typeof code === 'number' ? code : 0);
});
}
};