diff --git a/lib/cli.js b/lib/cli.js index 14389850..cd6c7515 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -35,7 +35,16 @@ const main = async () => { params[arg] = true; } - const {'dry-run': isDryRun, 'non-interactive': isNonInteractiveMode, hook: isHook, ...passThroughParams} = params; + const {'dry-run': isDryRun, 'non-interactive': isNonInteractiveMode, hook: isHook, body, breaking, issues, lerna, scope, subject, type, ...passThroughParams} = params; + const cliAnswers = { + body, + breaking, + issues, + lerna, + scope, + subject, + type + }; if (isDryRun) { // eslint-disable-next-line no-console @@ -43,9 +52,9 @@ const main = async () => { } if (isNonInteractiveMode) { - await runNonInteractiveMode(state, passThroughParams); + await runNonInteractiveMode(state, cliAnswers); } else { - await runInteractiveQuestions(state); + await runInteractiveQuestions(state, cliAnswers); } const message = formatCommitMessage(state); diff --git a/lib/runNonInteractiveMode.js b/lib/runNonInteractiveMode.js index 2836e9e9..f3de073e 100644 --- a/lib/runNonInteractiveMode.js +++ b/lib/runNonInteractiveMode.js @@ -1,10 +1,14 @@ -const runNonInteractiveMode = (state, params) => { - state.config.disableEmoji = true; +const runNonInteractiveMode = (state, {type = 'chore', subject = 'automated commit', ...restAnswers}) => { + const answers = { + subject, + type, + ...restAnswers + }; Object.keys(state.answers).forEach((key) => { - if (params[key]) { - state.answers[key] = params[key]; - delete params[key]; + if (answers[key]) { + state.answers[key] = answers[key]; + delete answers[key]; } }); };