MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / systemdQuote

Function systemdQuote

apps/cli/src/service.ts:439–448  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

437const SYSTEMD_BARE_VALUE = /^[A-Za-z0-9_@%+=:,./-]+$/;
438
439const systemdQuote = (value: string): string => {
440 if (SYSTEMD_BARE_VALUE.test(value)) return value;
441 const escaped = value
442 .replaceAll("\\", "\\\\")
443 .replaceAll('"', '\\"')
444 .replaceAll("\n", "\\n")
445 .replaceAll("\r", "\\r")
446 .replaceAll("\t", "\\t");
447 return `"${escaped}"`;
448};
449
450/** Render a systemd --user unit. Pure (snapshot-tested). */
451export const generateSystemdUnit = (options: SystemdUnitOptions): string => {

Callers 1

generateSystemdUnitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected