Skip to content

Commit c5657a3

Browse files
committed
Output the help message line by line.
1 parent b7d1d11 commit c5657a3

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/compiler/tsc.ts

Lines changed: 15 additions & 14 deletions
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 = [];
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,19 @@ 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
}
768-
769-
sys.write(output);
768+
output.forEach(function (val) {
769+
sys.write(val);
770+
})
770771
return;
771772

772773
function getParamType(option: CommandLineOption) {

0 commit comments

Comments
 (0)