From 0ac33bac3c75acedf177d41799ad2747f7240651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 3 Nov 2022 10:17:29 +0100 Subject: [PATCH] #502: added new skipInteraction options gitPush and backupBUs to init command --- README.md | 2 +- lib/util/init.git.js | 4 ++-- lib/util/init.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 68ebdde14..e707f287a 100644 --- a/README.md +++ b/README.md @@ -476,7 +476,7 @@ Example url: `https://mcg123abcysykllg-0321cbs8bbt64.auth.marketingcloudapis.com > You can run this command without the interactive wizard asking questions using the `--skipInteraction` (or short`--yes`/`--y`) flag. In this case, you need to provide a few values in the command: > > ```bash -> mcdev init --y.credentialName "yourCustomCredentialName" --y.client_id "yourClientIdHere" --y.client_secret "yourClientSecretHere" --y.auth_url "https://yourTenantSubdomainHere.auth.marketingcloudapis.com/" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git" --y.account_id 00000000 +> mcdev init --y.credentialName "yourCustomCredentialName" --y.client_id "yourClientIdHere" --y.client_secret "yourClientSecretHere" --y.auth_url "https://yourTenantSubdomainHere.auth.marketingcloudapis.com/" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git" --y.account_id 00000000 --y.backupBUs "yes" --y.gitPush "yes" > ``` #### 6.1.2. upgrade diff --git a/lib/util/init.git.js b/lib/util/init.git.js index dd61c27ab..eb1cbb967 100644 --- a/lib/util/init.git.js +++ b/lib/util/init.git.js @@ -100,7 +100,7 @@ const Init = { `Your remote Git repository is still empty and ready to store your initial backup. Hint: This is the server version of the repo which you share with your team.` ); let responses; - if (!skipInteraction) { + if (!skipInteraction || !skipInteraction.gitPush !== 'yes') { responses = await inquirer.prompt([ { type: 'confirm', @@ -110,7 +110,7 @@ const Init = { }, ]); } - if (skipInteraction || responses.gitPush) { + if (skipInteraction.gitPush === 'yes' || responses.gitPush) { Util.execSync('git', ['push', '-u', 'origin', 'master']); } } else if (remoteBranchesExist === true) { diff --git a/lib/util/init.js b/lib/util/init.js index a2c01a252..a7b3cddc2 100644 --- a/lib/util/init.js +++ b/lib/util/init.js @@ -180,7 +180,7 @@ const Init = { async _downloadAllBUs(bu, gitStatus) { const skipInteraction = Util.skipInteraction; let responses; - if (!skipInteraction) { + if (!skipInteraction || skipInteraction.backupBUs !== 'yes') { responses = await inquirer.prompt([ { type: 'confirm', @@ -190,7 +190,7 @@ const Init = { }, ]); } - if (skipInteraction || responses.initialRetrieveAll) { + if (skipInteraction.backupBUs === 'yes' || responses.initialRetrieveAll) { Util.execSync('mcdev', ['retrieve', bu]); if (gitStatus === 'init') {