-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathcli.ts
95 lines (81 loc) · 2.05 KB
/
cli.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env node
let colors = require('colors')
let version = require('../../package.json').version
const program = require('commander')
.version(version)
let { create } = require('./lib/create')
let { list } = require('./lib/list')
let { generate } = require('./lib/generate')
let { update } = require('./lib/update')
let { init } = require('./lib/init')
let { logs } = require('./lib/logs')
let { output } = require('./lib/output')
let { search } = require('./lib/search')
let { status } = require('./lib/status')
let { compress } = require('./lib/compress')
program
.command('new <title...>')
.alias('n')
.description('create new ADR', {
title: 'Title of the new ADR to generate'
})
.action(titles => {
titles.forEach(title => create(title))
})
program
.command('list')
.alias('l')
.description('list all ADR')
.action(list)
program
.command('update')
.alias('u')
.description('update ADR')
.action(update)
program
.command('status <index>')
.alias('S')
.description('change one ADR status', {
index: 'Index of the ADR (see ADR file prefix)'
})
.action(status)
program
.command('generate <type>')
.alias('g')
.description('generate toc or graph, default toc', {
type: 'toc | graph'
})
.action(generate)
program
.command('init <language>')
.alias('i')
.description('init ADR with language, e.g. ``adr init en``')
.action(init)
program
.command('logs <index>')
.alias('L')
.description('list one ADR status logs', {
index: 'Index of the ADR (see ADR file prefix)'
})
.action(logs)
program
.command('export <format>')
.alias('o')
.description('export ADR reporter in HTML, CSV, JSON', {
format: 'csv | json | html'
})
.action(output)
program
.command('search <keywords>')
.alias('s')
.description('search ADRs by keywords')
.action(search)
program
.command('compress')
.alias('c')
.description('compress ADR image assets')
.action(compress)
program.parse(process.argv)
if (!process.argv.slice(2).length || !process.argv.length) {
program.outputHelp(colors.green)
}