-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo.ts
More file actions
31 lines (29 loc) · 896 Bytes
/
demo.ts
File metadata and controls
31 lines (29 loc) · 896 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
25
26
27
28
29
30
31
import { Command } from 'commander';
import chalkTemplate from 'chalk-template';
import runTask from '../../tasks/example/example-task.js';
import { logErrorAndExit } from '../../logging.js';
const demo = new Command('demo')
.description(
'demos usages of commands, template and orientation to create your own'
)
.option(
'--rc-only',
chalkTemplate`only read configuration from {bold .example-demorc.json}, skip prompts`,
true
)
.option(
'--revert',
chalkTemplate`revert command defined by {bold .example-demorc.json}, implies {bold --rc-only}`,
false
)
.option('--cleanup', 'clean up tmp dirs before running', true)
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.rcOnly,
options.revert,
options.cleanup,
options.debug
).catch(logErrorAndExit);
});
export default demo;