File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ const flags = {
5656 type : 'boolean' ,
5757 description : 'display this help message'
5858 } ,
59+ 'help-url' : {
60+ alias : 'H' ,
61+ type : 'string' ,
62+ description : 'helpurl in error message'
63+ } ,
5964 from : {
6065 alias : 'f' ,
6166 default : null ,
@@ -220,8 +225,9 @@ async function main(options) {
220225 const output = format ( report , {
221226 color : flags . color ,
222227 verbose : flags . verbose ,
223- helpUrl :
224- 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
228+ helpUrl : flags . helpUrl
229+ ? flags . helpUrl . trim ( )
230+ : 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
225231 } ) ;
226232
227233 if ( ! flags . quiet && output !== '' ) {
Original file line number Diff line number Diff line change @@ -71,6 +71,20 @@ test('should produce help for problems', async t => {
7171 t . is ( actual . code , 1 ) ;
7272} ) ;
7373
74+ test ( 'should produce help for problems with correct helpurl' , async t => {
75+ const cwd = await git . bootstrap ( 'fixtures/default' ) ;
76+ const actual = await cli (
77+ [ '-H https://github.com/conventional-changelog/commitlint/#testhelpurl' ] ,
78+ { cwd}
79+ ) ( 'foo: bar' ) ;
80+ t . true (
81+ actual . stdout . includes (
82+ 'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl'
83+ )
84+ ) ;
85+ t . is ( actual . code , 1 ) ;
86+ } ) ;
87+
7488test ( 'should fail for input from stdin without rules' , async t => {
7589 const cwd = await git . bootstrap ( 'fixtures/empty' ) ;
7690 const actual = await cli ( [ ] , { cwd} ) ( 'foo: bar' ) ;
You can’t perform that action at this time.
0 commit comments