Files
privacy.sexy/src/application/Context/State/Code/Generation/Languages/ShellBuilder.ts
undergroundwires 6b3f4659df Use line endings based on script language #88
Use CRLF in batchfile and LF in shellscript.
2022-09-28 23:09:23 +02:00

21 lines
459 B
TypeScript

import { CodeBuilder } from '@/application/Context/State/Code/Generation/CodeBuilder';
export class ShellBuilder extends CodeBuilder {
protected getCommentDelimiter(): string {
return '#';
}
protected writeStandardOut(text: string): string {
return `echo '${escapeForEcho(text)}'`;
}
protected getNewLineTerminator(): string {
return '\n';
}
}
function escapeForEcho(text: string) {
return text
.replace(/'/g, '\'\\\'\'');
}