Use line endings based on script language #88
Use CRLF in batchfile and LF in shellscript.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { ICodeBuilder } from './ICodeBuilder';
|
||||
|
||||
const NewLine = '\n';
|
||||
const TotalFunctionSeparatorChars = 58;
|
||||
|
||||
export abstract class CodeBuilder implements ICodeBuilder {
|
||||
@@ -59,10 +58,12 @@ export abstract class CodeBuilder implements ICodeBuilder {
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
return this.lines.join(NewLine);
|
||||
return this.lines.join(this.getNewLineTerminator());
|
||||
}
|
||||
|
||||
protected abstract getCommentDelimiter(): string;
|
||||
|
||||
protected abstract writeStandardOut(text: string): string;
|
||||
|
||||
protected abstract getNewLineTerminator(): string;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ export class BatchBuilder extends CodeBuilder {
|
||||
protected writeStandardOut(text: string): string {
|
||||
return `echo ${escapeForEcho(text)}`;
|
||||
}
|
||||
|
||||
protected getNewLineTerminator(): string {
|
||||
return '\r\n';
|
||||
}
|
||||
}
|
||||
|
||||
function escapeForEcho(text: string) {
|
||||
|
||||
@@ -8,6 +8,10 @@ export class ShellBuilder extends CodeBuilder {
|
||||
protected writeStandardOut(text: string): string {
|
||||
return `echo '${escapeForEcho(text)}'`;
|
||||
}
|
||||
|
||||
protected getNewLineTerminator(): string {
|
||||
return '\n';
|
||||
}
|
||||
}
|
||||
|
||||
function escapeForEcho(text: string) {
|
||||
|
||||
Reference in New Issue
Block a user