add initial macOS support #40

This commit is contained in:
undergroundwires
2021-01-13 16:31:20 +01:00
parent 2428de23ee
commit 8a8b7319d5
99 changed files with 2663 additions and 1135 deletions

View File

@@ -3,7 +3,7 @@ import { ICodeBuilder } from './ICodeBuilder';
const NewLine = '\n';
const TotalFunctionSeparatorChars = 58;
export class CodeBuilder implements ICodeBuilder {
export abstract class CodeBuilder implements ICodeBuilder {
private readonly lines = new Array<string>();
// Returns current line starting from 0 (no lines), or 1 (have single line)
@@ -29,7 +29,7 @@ export class CodeBuilder implements ICodeBuilder {
}
public appendCommentLine(commentLine?: string): CodeBuilder {
this.lines.push(`:: ${commentLine}`);
this.lines.push(`${this.getCommentDelimiter()} ${commentLine}`);
return this;
}
@@ -37,9 +37,8 @@ export class CodeBuilder implements ICodeBuilder {
if (!name) { throw new Error('name cannot be empty or null'); }
if (!code) { throw new Error('code cannot be empty or null'); }
return this
.appendLine()
.appendCommentLineWithHyphensAround(name)
.appendLine(`echo --- ${name}`)
.appendLine(this.writeStandardOut(`--- ${name}`))
.appendLine(code)
.appendTrailingHyphensCommentLine();
}
@@ -62,4 +61,7 @@ export class CodeBuilder implements ICodeBuilder {
public toString(): string {
return this.lines.join(NewLine);
}
protected abstract getCommentDelimiter(): string;
protected abstract writeStandardOut(text: string): string;
}