Skip to content

Commit 6dc4cd2

Browse files
committed
fix: preserve whitespace in wrapped words
1 parent f2b7650 commit 6dc4cd2

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/@ionic/cli-utils/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"@types/semver": "^5.3.33",
8686
"@types/tar": "^1.0.29",
8787
"@types/uuid": "^3.4.0",
88-
"@types/wrap-ansi": "^2.0.14",
8988
"rxjs": "^5.4.2"
9089
},
9190
"jest": {

packages/@ionic/cli-utils/src/lib/utils/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function indent(n: number = 4): string {
4848
}
4949

5050
export function wordWrap(msg: string, { indentation = 0, append = '' }: { indentation?: number, append?: string }) {
51-
return wrapAnsi(msg, TTY_WIDTH - indentation - append.length).split('\n').join(`${append}\n${indent(indentation)}`);
51+
return wrapAnsi(msg, TTY_WIDTH - indentation - append.length, { trim: false }).split('\n').join(`${append}\n${indent(indentation)}`);
5252
}
5353

5454
export function generateFillSpaceStringList(list: string[], optimalLength: number = 1, fillCharacter: string = ' '): string[] {

packages/@ionic/cli-utils/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"../../../types/strip-ansi.d.ts",
3939
"../../../types/superagent.d.ts",
4040
"../../../types/tiny-lr.d.ts",
41+
"../../../types/wrap-ansi.d.ts",
4142
"src/**/*.ts"
4243
],
4344
"exclude": [

types/wrap-ansi.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
declare module 'wrap-ansi' {
2+
function wrapAnsi(input: string, columns: number, options?: { hard?: boolean; trim?: boolean; wordWrap?: boolean }): string;
3+
4+
namespace wrapAnsi {}
5+
6+
export = wrapAnsi;
7+
}

0 commit comments

Comments
 (0)