Skip to content

Commit

Permalink
#502: added new skipInteraction options gitPush and backupBUs to init…
Browse files Browse the repository at this point in the history
… command
  • Loading branch information
JoernBerkefeld committed Nov 3, 2022
1 parent 39f6ac8 commit 0ac33ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/util/init.git.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/util/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -190,7 +190,7 @@ const Init = {
},
]);
}
if (skipInteraction || responses.initialRetrieveAll) {
if (skipInteraction.backupBUs === 'yes' || responses.initialRetrieveAll) {
Util.execSync('mcdev', ['retrieve', bu]);

if (gitStatus === 'init') {
Expand Down

0 comments on commit 0ac33ba

Please sign in to comment.