@@ -23,8 +23,8 @@ const rules = {
23
23
} ;
24
24
25
25
const configuration = {
26
- string : [ 'cwd' , 'from' , 'to' , 'extends' , 'parser-preset' ] ,
27
- boolean : [ 'edit' , ' help', 'version' , 'quiet' , 'color' ] ,
26
+ string : [ 'cwd' , 'from' , 'to' , 'edit' , ' extends', 'parser-preset' ] ,
27
+ boolean : [ 'help' , 'version' , 'quiet' , 'color' ] ,
28
28
alias : {
29
29
c : 'color' ,
30
30
d : 'cwd' ,
@@ -40,7 +40,8 @@ const configuration = {
40
40
description : {
41
41
color : 'toggle colored output' ,
42
42
cwd : 'directory to execute in' ,
43
- edit : 'read last commit message found in ./.git/COMMIT_EDITMSG' ,
43
+ edit :
44
+ 'read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG' ,
44
45
extends : 'array of shareable configurations to extend' ,
45
46
from : 'lower end of the commit range to lint; applies if edit=false' ,
46
47
to : 'upper end of the commit range to lint; applies if edit=false' ,
@@ -74,10 +75,11 @@ const cli = meow(
74
75
const load = ( seed , opts ) => core . load ( seed , opts ) ;
75
76
76
77
function main ( options ) {
78
+ normalizeOptions ( options ) ;
79
+
77
80
const raw = options . input ;
78
81
const flags = options . flags ;
79
82
const fromStdin = rules . fromStdin ( raw , flags ) ;
80
-
81
83
const range = pick ( flags , 'edit' , 'from' , 'to' ) ;
82
84
const input = fromStdin ? stdin ( ) : core . read ( range , { cwd : flags . cwd } ) ;
83
85
const fmt = new chalk . constructor ( { enabled : flags . color } ) ;
@@ -113,6 +115,17 @@ function main(options) {
113
115
) ;
114
116
}
115
117
118
+ function normalizeOptions ( options ) {
119
+ const flags = options . flags ;
120
+
121
+ // The `edit` flag is either a boolean or a string but we are only allowed
122
+ // to specify one of them in minimist
123
+ if ( flags . edit === '' ) {
124
+ flags . edit = true ;
125
+ flags . e = true ;
126
+ }
127
+ }
128
+
116
129
function getSeed ( seed ) {
117
130
const e = Array . isArray ( seed . extends ) ? seed . extends : [ seed . extends ] ;
118
131
const n = e . filter ( i => typeof i === 'string' ) ;
0 commit comments