diff --git a/lib/utils/cli.js b/lib/utils/cli.js index 2118995b1..bae94b6f6 100644 --- a/lib/utils/cli.js +++ b/lib/utils/cli.js @@ -332,8 +332,11 @@ exports.select = function(message, choices, multi, doneLabel) { selectStateDown(4); } else if (key.name == 'return' || key.name == 'space' || key.name == 'enter') { - // Check if "done" option or ctrl was pressed. - if ((Select.state.choices[Select.state.index - 1].action + // Check if "cancel" option, "done" option or ctrl was pressed. + if (Select.state.choices[Select.state.index - 1].action + && Select.state.choices[Select.state.index - 1].action.toLowerCase() === 'cancel') { + process.exit(); + } else if ((Select.state.choices[Select.state.index - 1].action && Select.state.choices[Select.state.index - 1].action.toLowerCase() === 'done') || key.name == 'enter') { process.stdin.removeListener('keypress', keypressHandler); return Select._close(); @@ -380,7 +383,12 @@ exports.select = function(message, choices, multi, doneLabel) { { action: 'Done', label: Select.state.doneLabel, - }); + }, + { + action: 'Cancel', + label: 'Cancel' + } + ); } // Log Message