Skip to content

Commit 070aa83

Browse files
authored
Merge pull request #10980 from Dafrok/master
Resolve a problem of 1024 bytes limited help message in some terminals.
2 parents 19aac12 + 4ec9209 commit 070aa83

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/compiler/tsc.ts

+15-13
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ namespace ts {
667667
}
668668

669669
function printHelp() {
670-
let output = "";
670+
const output: string[] = [];
671671

672672
// We want to align our "syntax" and "examples" commands to a certain margin.
673673
const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length;
@@ -678,17 +678,17 @@ namespace ts {
678678
let syntax = makePadding(marginLength - syntaxLength);
679679
syntax += "tsc [" + getDiagnosticText(Diagnostics.options) + "] [" + getDiagnosticText(Diagnostics.file) + " ...]";
680680

681-
output += getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax);
682-
output += sys.newLine + sys.newLine;
681+
output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax));
682+
output.push(sys.newLine + sys.newLine);
683683

684684
// Build up the list of examples.
685685
const padding = makePadding(marginLength);
686-
output += getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine;
687-
output += padding + "tsc --outFile file.js file.ts" + sys.newLine;
688-
output += padding + "tsc @args.txt" + sys.newLine;
689-
output += sys.newLine;
686+
output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine);
687+
output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine);
688+
output.push(padding + "tsc @args.txt" + sys.newLine);
689+
output.push(sys.newLine);
690690

691-
output += getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine;
691+
output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine);
692692

693693
// Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch")
694694
const optsList = filter(optionDeclarations.slice(), v => !v.experimental);
@@ -755,18 +755,20 @@ namespace ts {
755755
const usage = usageColumn[i];
756756
const description = descriptionColumn[i];
757757
const kindsList = optionsDescriptionMap[description];
758-
output += usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine;
758+
output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine);
759759

760760
if (kindsList) {
761-
output += makePadding(marginLength + 4);
761+
output.push(makePadding(marginLength + 4));
762762
for (const kind of kindsList) {
763-
output += kind + " ";
763+
output.push(kind + " ");
764764
}
765-
output += sys.newLine;
765+
output.push(sys.newLine);
766766
}
767767
}
768768

769-
sys.write(output);
769+
for (const line of output) {
770+
sys.write(line);
771+
}
770772
return;
771773

772774
function getParamType(option: CommandLineOption) {

0 commit comments

Comments
 (0)