Skip to content

Commit

Permalink
feat: use short link to the Integrated IaC docs
Browse files Browse the repository at this point in the history
  • Loading branch information
francescomari committed Oct 5, 2022
1 parent e9b88b9 commit 8fd823d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/lib/iac/test/v2/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
colors,
contentPadding,
} from '../../../formatters/iac-output/text/utils';
import * as wrapAnsi from 'wrap-ansi';

export function buildOutput({
scanResult,
Expand Down Expand Up @@ -188,24 +189,22 @@ function buildTextOutput({
response += EOL;
response += colors.title('Info') + EOL;
response += EOL;
response +=
contentPadding +
`Your organization ${orgSettings.meta.org} is using Integrated IaC. To switch to Current IaC,` +
EOL;
response +=
contentPadding +
`use --org=<ORG_ID> to select a different organization. For more information about Integrated IaC, see:` +
EOL;
response += EOL;
response +=
contentPadding +
contentPadding +
'https://docs.snyk.io/products/snyk-infrastructure-as-code/snyk-cli-for-infrastructure-as-code/integrated-infrastructure-as-code' +
EOL;
response += wrapWithPadding(infoMessage(orgSettings), 80) + EOL;

return response;
}

function wrapWithPadding(s: string, columns: number): string {
return wrapAnsi(s, columns)
.split('\n')
.map((s) => contentPadding + s)
.join('\n');
}

function infoMessage(orgSettings: IacOrgSettings): string {
return `Your organization ${orgSettings.meta.org} is using Integrated IaC. To switch to Current IaC, use --org=<ORG_ID> to select a different organization. For more information about Integrated IaC, see https://snyk.co/integrated-iac.`;
}

function assertHasSuccessfulScans(
scanResult: TestOutput,
responseData: Omit<ResponseData, 'response'>,
Expand Down

0 comments on commit 8fd823d

Please sign in to comment.