File tree Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ filters : [
3
+ {
4
+ name : 'Changes' ,
5
+ regExp : / [ \u4e00 - \u9fa5 ] / ,
6
+ }
7
+ ] ,
8
+ parse ( commits ) {
9
+ let output = '' ;
10
+
11
+ commits . forEach ( ( log ) => {
12
+ log . results . forEach ( ( result ) => {
13
+ output += `${ result . filter . name } :\n` ;
14
+
15
+ result . commits . forEach ( ( commit ) => {
16
+ output += `- ${ commit . s } ${ commit . an } \n` ;
17
+ } ) ;
18
+ } ) ;
19
+ } ) ;
20
+
21
+ return output ;
22
+ }
23
+ } ;
Original file line number Diff line number Diff line change @@ -49,6 +49,12 @@ $ picklog -o CHANGELOG.md
49
49
50
50
e.g: ` picklog -g v2.0.0 -w CHANGELOG.md `
51
51
52
+ - ** ` -c ` or ` --config ` **
53
+
54
+ 指定配置文件,默认是` .picklogrc.js ` ( Custom config file. Default ".picklogrc" )
55
+
56
+ e.g: ` picklog -c .picklogrc.dev.js `
57
+
52
58
53
59
### API
54
60
``` javascript
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ const { argv } = yargs
42
42
. option ( 'o' , {
43
43
alias : 'overwrite' ,
44
44
describe : 'Overwrite stdout to this file.' ,
45
+ } )
46
+ . option ( 'c' , {
47
+ alias : 'config' ,
48
+ describe : 'Custom config file. (Default ".picklogrc")' ,
45
49
} ) ;
46
50
47
51
if ( argv . _ . indexOf ( 'init' ) > - 1 ) {
Original file line number Diff line number Diff line change @@ -8,12 +8,15 @@ function picklog(_args) {
8
8
gitLogArgs : '' , // 透传给命令 git log 的参数
9
9
latest : false , // 是否只取上一个tag后的commit
10
10
} , _args ) ;
11
+
12
+ const picklogrc = args . config || '.picklogrc.js' ;
13
+
11
14
let setting ;
12
15
let pkg ;
13
16
14
17
try {
15
- fs . accessSync ( path . resolve ( '. picklogrc.js' ) ) ;
16
- setting = require ( path . resolve ( '. picklogrc.js' ) ) ; // eslint-disable-line global-require,import/no-dynamic-require
18
+ fs . accessSync ( path . resolve ( picklogrc ) ) ;
19
+ setting = require ( path . resolve ( picklogrc ) ) ; // eslint-disable-line global-require,import/no-dynamic-require
17
20
18
21
fs . accessSync ( path . resolve ( 'package.json' ) ) ;
19
22
pkg = require ( path . resolve ( 'package.json' ) ) ; // eslint-disable-line global-require,import/no-dynamic-require
You can’t perform that action at this time.
0 commit comments