(value: string)
| 430 | const SYSTEMD_BARE_VALUE = /^[A-Za-z0-9_@%+=:,./-]+$/; |
| 431 | |
| 432 | const systemdQuote = (value: string): string => { |
| 433 | if (SYSTEMD_BARE_VALUE.test(value)) return value; |
| 434 | const escaped = value |
| 435 | .replaceAll("\\", "\\\\") |
| 436 | .replaceAll('"', '\\"') |
| 437 | .replaceAll("\n", "\\n") |
| 438 | .replaceAll("\r", "\\r") |
| 439 | .replaceAll("\t", "\\t"); |
| 440 | return `"${escaped}"`; |
| 441 | }; |
| 442 | |
| 443 | /** Render a systemd --user unit. Pure (snapshot-tested). */ |
| 444 | export const generateSystemdUnit = (options: SystemdUnitOptions): string => { |
no outgoing calls
no test coverage detected