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