@@ -50,10 +50,11 @@ const setOptions = (program, definitions, terms) => {
5050
5151const createProgram = ( program , definitions , terms ) => {
5252 return setOptions ( program , definitions , terms )
53- . option ( `-d, --duet` , 'run git-duet mode' , false )
54- . option ( `-D, --dry-run` , 'run dry-run mode' , false )
55- . option ( `-i, --interactive` , 'run interactive mode' , false )
56- . option ( `-s, --skip-options` , 'skip not required term input (interactive mode only)' , false )
53+ . option ( `-d, --duet` , 'run git-duet mode' )
54+ . option ( `-D, --dry-run` , 'run dry-run mode' )
55+ . option ( `-i, --interactive` , 'run interactive mode' )
56+ . option ( `-s, --skip-options` , 'skip not required term input (interactive mode only)' )
57+ . option ( `-S, --silent` , "don't show commit command" )
5758 . version ( version )
5859 . parse ( process . argv )
5960}
@@ -196,26 +197,29 @@ const replaceTerm = (program, template, definition, term) => {
196197 return _ . replace ( template , `<${ term } >` , decoratedValue )
197198}
198199
199- const gitCommit = ( commitMessage , duet = false , dryRun = false ) => {
200+ const gitCommit = ( commitMessage , duet = false , silent = false , dryRun = false ) => {
201+ let command
202+ if ( duet ) {
203+ command = `git duet-commit -m "${ commitMessage } "`
204+ } else {
205+ command = `git commit -m "${ commitMessage } "`
206+ }
207+
208+ if ( ! silent ) console . log ( `${ infoColor } ${ command } ${ reset } ` )
209+
200210 if ( dryRun ) {
201211 console . log ( "-------------------------" )
202212 console . log ( commitMessage )
203213 console . log ( "-------------------------" )
204214 } else {
205- let command
206- if ( duet ) {
207- command = `git duet-commit -m "${ commitMessage } "`
208- } else {
209- command = `git commit -m "${ commitMessage } "`
210- }
211- console . log ( `${ infoColor } ${ command } ${ reset } ` )
212215 execSync ( command )
213216 }
214217}
215218
216219const main = ( program , template , definitions , terms ) => {
217220 const commitMessage = replaceTerms ( program , template , definitions , terms )
218- gitCommit ( commitMessage . trim ( ) , program . duet , program . dryRun )
221+
222+ gitCommit ( commitMessage . trim ( ) , program . duet , program . silent , program . dryRun )
219223}
220224
221225//
0 commit comments