File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,12 @@ module.exports = {
5353 {
5454 short : '-o' ,
5555 name : 'override' ,
56- description : 'Override the release notes if exist.'
56+ description : 'Override the release notes if exist'
57+ } ,
58+ {
59+ short : '-B' ,
60+ name : 'debug' ,
61+ description : 'Run the command in debugging mode'
5762 } ,
5863 {
5964 short : '-t' ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const defaults = {
1414 prerelease : false ,
1515 generate : false ,
1616 override : false ,
17+ debug : false ,
1718 ignoreLabels : false ,
1819 ignoreIssuesWith : false ,
1920 ignoreCommitsWith : false ,
@@ -53,6 +54,10 @@ class Gren {
5354 throw chalk . red ( 'You must provide the TOKEN' ) ;
5455 }
5556
57+ if ( this . options . debug ) {
58+ this . _outputOptions ( this . options ) ;
59+ }
60+
5661 const githubApi = new Github ( {
5762 token
5863 } , apiUrl ) ;
@@ -929,6 +934,20 @@ class Gren {
929934 } ) ;
930935 } ) ;
931936 }
937+
938+ /**
939+ * Output the options in the terminal in a formatted way
940+ *
941+ * @param {Object } options
942+ */
943+ _outputOptions ( options ) {
944+ const camelcaseToSpaces = value => value . replace ( / ( [ A - Z ] ) / g, ' $1' ) . toLowerCase ( ) . replace ( / \w / , a => a . toUpperCase ( ) ) ;
945+ const outputs = Object . entries ( options )
946+ . filter ( option => option !== 'debug' )
947+ . map ( ( [ key , value ] ) => `${ chalk . yellow ( camelcaseToSpaces ( key ) ) } : ${ value . toString ( ) || 'empty' } ` ) ;
948+
949+ process . stdout . write ( '\n' + chalk . blue ( 'Options: \n' ) + outputs . join ( '\n' ) + '\n' ) ;
950+ }
932951}
933952
934953export default Gren ;
You can’t perform that action at this time.
0 commit comments