@@ -14,58 +14,80 @@ const stdin = require('get-stdin');
14
14
const pkg = require ( '../package' ) ;
15
15
const help = require ( './help' ) ;
16
16
17
- const configuration = {
18
- string : [ 'cwd' , 'from' , 'to' , 'edit' , 'extends' , 'parser-preset' , 'config' ] ,
19
- boolean : [ 'help' , 'version' , 'quiet' , 'color' ] ,
20
- alias : {
21
- c : 'color' ,
22
- d : 'cwd' ,
23
- e : 'edit' ,
24
- f : 'from' ,
25
- t : 'to' ,
26
- q : 'quiet' ,
27
- h : 'help' ,
28
- g : 'config' ,
29
- v : 'version' ,
30
- x : 'extends' ,
31
- p : 'parser-preset'
17
+ const flags = {
18
+ color : {
19
+ alias : 'c' ,
20
+ default : true ,
21
+ description : 'toggle colored output' ,
22
+ type : 'boolean'
32
23
} ,
33
- description : {
34
- color : 'toggle colored output' ,
35
- cwd : 'directory to execute in' ,
36
- config : 'path to the config file' ,
37
- edit :
24
+ config : {
25
+ alias : 'g' ,
26
+ default : null ,
27
+ description : 'path to the config file' ,
28
+ type : 'string'
29
+ } ,
30
+ cwd : {
31
+ alias : 'd' ,
32
+ default : process . cwd ( ) ,
33
+ description : 'directory to execute in' ,
34
+ type : 'string'
35
+ } ,
36
+ edit : {
37
+ alias : 'e' ,
38
+ default : false ,
39
+ description :
38
40
'read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG' ,
39
- extends : 'array of shareable configurations to extend' ,
40
- from : 'lower end of the commit range to lint; applies if edit=false' ,
41
- to : 'upper end of the commit range to lint; applies if edit=false' ,
42
- quiet : 'toggle console output' ,
43
- 'parser-preset' :
44
- 'configuration preset to use for conventional-commits-parser'
41
+ type : 'string'
45
42
} ,
46
- default : {
47
- color : true ,
48
- cwd : process . cwd ( ) ,
49
- config : null ,
50
- edit : false ,
51
- from : null ,
52
- to : null ,
53
- quiet : false
43
+ extends : {
44
+ alias : 'x' ,
45
+ description : 'array of shareable configurations to extend' ,
46
+ type : 'string'
54
47
} ,
55
- unknown ( arg ) {
56
- throw new Error ( `unknown flags: ${ arg } ` ) ;
48
+ help : {
49
+ alias : 'h' ,
50
+ type : 'boolean'
51
+ } ,
52
+ from : {
53
+ alias : 'f' ,
54
+ default : null ,
55
+ description : 'lower end of the commit range to lint; applies if edit=false' ,
56
+ type : 'string'
57
+ } ,
58
+ 'parser-preset' : {
59
+ alias : 'p' ,
60
+ description : 'configuration preset to use for conventional-commits-parser' ,
61
+ type : 'string'
62
+ } ,
63
+ quiet : {
64
+ alias : 'q' ,
65
+ default : false ,
66
+ description : 'toggle console output' ,
67
+ type : 'boolean'
68
+ } ,
69
+ to : {
70
+ alias : 't' ,
71
+ default : null ,
72
+ description : 'upper end of the commit range to lint; applies if edit=false' ,
73
+ type : 'string'
74
+ } ,
75
+ version : {
76
+ alias : 'v' ,
77
+ type : 'boolean'
57
78
}
58
79
} ;
59
80
60
- const cli = meow (
61
- {
62
- help : `[input] reads from stdin if --edit, --from and --to are omitted\n${ help (
63
- configuration
64
- ) } `,
65
- description : `${ pkg . name } @${ pkg . version } - ${ pkg . description } `
66
- } ,
67
- configuration
68
- ) ;
81
+ const cli = meow ( {
82
+ description : `${ pkg . name } @${ pkg . version } - ${ pkg . description } ` ,
83
+ flags,
84
+ help : `[input] reads from stdin if --edit, --from and --to are omitted\n${ help (
85
+ flags
86
+ ) } `,
87
+ unknown ( arg ) {
88
+ throw new Error ( `unknown flags: ${ arg } ` ) ;
89
+ }
90
+ } ) ;
69
91
70
92
main ( cli ) . catch ( err =>
71
93
setTimeout ( ( ) => {
0 commit comments