From 9bb79a5fae3e8a33cec03e31d9ff2483974b6d23 Mon Sep 17 00:00:00 2001 From: Richard Sustek Date: Thu, 12 Dec 2024 14:23:25 +0100 Subject: [PATCH] Adds 'createReportFile' option for CLI --- README.md | 17 +++++++++-------- lib/node/cli/actions/import-action.ts | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6f4dcd2..eaac2e0 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ You may migrate content (items & asset) between Kontent.ai environments. For mig | **targetApiKey** | Management API key of target environment **(required)** | | **language** | Codename of language that items will be exported in **(required)** | | **items** | Comma separated list of items that will be exported **(required)** | -| force | Can be used to disable confirmation prompts. Available options: `true` & `false`. Detaults to `false` | +| force | Can be used to disable confirmation prompts. Available options: `true` & `false`. Defaults to `false` | ## Migrate CLI @@ -77,13 +77,14 @@ kontent-ai-migration-toolkit migrate --targetEnvironmentId=x --targetApiKey=x -- ## Configuration -| Config | Value | -| ----------------------- | ----------------------------------------------------------------------------------------------------- | -| **targetEnvironmentId** | Id of Kontent.ai environment **(required)** | -| **targetApiKey** | Management API key **(required)** | -| **filename** | Name of the zip file **(required)** | -| baseUrl | Custom base URL for Kontent.ai API calls | -| force | Can be used to disable confirmation prompts. Available options: `true` & `false`. Detaults to `false` | +| Config | Value | +| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| **targetEnvironmentId** | Id of Kontent.ai environment **(required)** | +| **targetApiKey** | Management API key **(required)** | +| **filename** | Name of the zip file **(required)** | +| baseUrl | Custom base URL for Kontent.ai API calls | +| force | Can be used to disable confirmation prompts. Options: `true` & `false`. Defaults to `false` | +| createReportFile | When enabled, a detailed `json` file will be created in current dir with import details. Options: `true` & `false`. Defaults to `false` | ## Import CLI diff --git a/lib/node/cli/actions/import-action.ts b/lib/node/cli/actions/import-action.ts index c52c226..2fa695c 100644 --- a/lib/node/cli/actions/import-action.ts +++ b/lib/node/cli/actions/import-action.ts @@ -7,6 +7,7 @@ export async function importActionAsync(argsFetcher: CliArgumentsFetcher): Promi const environmentId = argsFetcher.getRequiredArgumentValue('targetEnvironmentId'); const apiKey = argsFetcher.getRequiredArgumentValue('targetApiKey'); const baseUrl = argsFetcher.getOptionalArgumentValue('baseUrl'); + const createReportFile = argsFetcher.getBooleanArgumentValue('createReportFile', false); const force = argsFetcher.getBooleanArgumentValue('force', false); const filename = argsFetcher.getOptionalArgumentValue('filename') ?? defaultZipFilename; @@ -27,7 +28,8 @@ export async function importActionAsync(argsFetcher: CliArgumentsFetcher): Promi data: importData, baseUrl: baseUrl, environmentId: environmentId, - apiKey: apiKey + apiKey: apiKey, + createReportFile: createReportFile }); log.log({ type: 'completed', message: `Import has been successful` });