Skip to content

Commit b0c0789

Browse files
Merge pull request #4106 from snyk/feat/use-short-integrated-iac-link
feat: use short link to the Integrated IaC docs
2 parents e9b88b9 + 8fd823d commit b0c0789

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/lib/iac/test/v2/output.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
colors,
3434
contentPadding,
3535
} from '../../../formatters/iac-output/text/utils';
36+
import * as wrapAnsi from 'wrap-ansi';
3637

3738
export function buildOutput({
3839
scanResult,
@@ -188,24 +189,22 @@ function buildTextOutput({
188189
response += EOL;
189190
response += colors.title('Info') + EOL;
190191
response += EOL;
191-
response +=
192-
contentPadding +
193-
`Your organization ${orgSettings.meta.org} is using Integrated IaC. To switch to Current IaC,` +
194-
EOL;
195-
response +=
196-
contentPadding +
197-
`use --org=<ORG_ID> to select a different organization. For more information about Integrated IaC, see:` +
198-
EOL;
199-
response += EOL;
200-
response +=
201-
contentPadding +
202-
contentPadding +
203-
'https://docs.snyk.io/products/snyk-infrastructure-as-code/snyk-cli-for-infrastructure-as-code/integrated-infrastructure-as-code' +
204-
EOL;
192+
response += wrapWithPadding(infoMessage(orgSettings), 80) + EOL;
205193

206194
return response;
207195
}
208196

197+
function wrapWithPadding(s: string, columns: number): string {
198+
return wrapAnsi(s, columns)
199+
.split('\n')
200+
.map((s) => contentPadding + s)
201+
.join('\n');
202+
}
203+
204+
function infoMessage(orgSettings: IacOrgSettings): string {
205+
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.`;
206+
}
207+
209208
function assertHasSuccessfulScans(
210209
scanResult: TestOutput,
211210
responseData: Omit<ResponseData, 'response'>,

0 commit comments

Comments
 (0)