mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +00:00
cancelling prompts is treated as error
This commit is contained in:
parent
a9620ba6e4
commit
a1f34b312a
@ -342,7 +342,8 @@ program
|
||||
}
|
||||
|
||||
await confirmMessage(
|
||||
'The transfer will delete all data in the remote database and media files. Are you sure you want to proceed?'
|
||||
'The transfer will delete all data in the remote database and media files. Are you sure you want to proceed?',
|
||||
{ failMessage: 'Transfer process aborted' }
|
||||
)(thisCommand);
|
||||
}
|
||||
)
|
||||
@ -450,7 +451,8 @@ program
|
||||
.hook(
|
||||
'preAction',
|
||||
confirmMessage(
|
||||
'The import will delete all data in your database and media files. Are you sure you want to proceed?'
|
||||
'The import will delete all data in your database and media files. Are you sure you want to proceed?',
|
||||
{ failMessage: 'Import process aborted' }
|
||||
)
|
||||
)
|
||||
.action(getLocalScript('transfer/import'));
|
||||
|
@ -97,7 +97,7 @@ const promptEncryptionKey = async (thisCommand) => {
|
||||
* @param {string} message The message to confirm with user
|
||||
* @param {object} options Additional options
|
||||
*/
|
||||
const confirmMessage = (message) => {
|
||||
const confirmMessage = (message, { failMessage } = {}) => {
|
||||
return async (command) => {
|
||||
// if we have a force option, assume yes
|
||||
const opts = command.opts();
|
||||
@ -116,7 +116,7 @@ const confirmMessage = (message) => {
|
||||
},
|
||||
]);
|
||||
if (!answers.confirm) {
|
||||
exitWith(1);
|
||||
exitWith(1, failMessage);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user