|
1 | | -import chalk from "chalk"; |
2 | 1 | import { match, P } from "ts-pattern"; |
3 | 2 |
|
4 | | -import { logError, logInfo, LogOptions } from "../../../log.js"; |
| 3 | +import { logError, LogOptions } from "../../../log.js"; |
5 | 4 | import { syncEntityChoices, SyncEntityName } from "../../../modules/sync/constants/entities.js"; |
6 | 5 | import { printDiff } from "../../../modules/sync/printDiff.js"; |
7 | 6 | import { SyncEntities, syncRunInternal, SyncRunParams } from "../../../modules/sync/syncRun.js"; |
8 | | -import { requestConfirmation } from "../../../modules/sync/utils/consoleHelpers.js"; |
| 7 | +import { checkConfirmation } from "../../../modules/sync/utils/consoleHelpers.js"; |
9 | 8 | import { RegisterCommand } from "../../../types/yargs.js"; |
10 | 9 | import { simplifyErrors } from "../../../utils/error.js"; |
11 | 10 |
|
@@ -91,18 +90,14 @@ const syncRunCli = async (params: SyncModelRunCliParams) => { |
91 | 90 | await syncRunInternal(resolvedParams, `sync-${commandName}`, async (diffModel) => { |
92 | 91 | printDiff(diffModel, new Set(params.entities), params); |
93 | 92 |
|
94 | | - const warningMessage = chalk.yellow( |
95 | | - `⚠ Running this operation may result in irreversible changes to the content in environment ${params.targetEnvironmentId}. Mentioned changes might include: |
| 93 | + await checkConfirmation({ |
| 94 | + message: |
| 95 | + `⚠ Running this operation may result in irreversible changes to the content in environment ${params.targetEnvironmentId}. Mentioned changes might include: |
96 | 96 | - Removing content due to element deletion |
97 | 97 | OK to proceed y/n? (suppress this message with --sw parameter)\n`, |
98 | | - ); |
99 | | - |
100 | | - const confirmed = !params.skipConfirmation ? await requestConfirmation(warningMessage) : true; |
101 | | - |
102 | | - if (!confirmed) { |
103 | | - logInfo(params, "standard", chalk.red("Operation aborted.")); |
104 | | - process.exit(1); |
105 | | - } |
| 98 | + skipConfirmation: params.skipConfirmation, |
| 99 | + logOptions: params, |
| 100 | + }); |
106 | 101 | }); |
107 | 102 | } catch (e) { |
108 | 103 | logError(params, JSON.stringify(e, Object.getOwnPropertyNames(e))); |
|
0 commit comments