POSIX single-quote escape for arbitrary strings. Wraps the value in single quotes and escapes any embedded single quote as `'\''` (end quote, escaped quote, start quote). The result is safe to paste into any POSIX shell without parameter expansion, command substitution, or backslash interpretation. We use this for paths that come from the install manifest, which is user-writable — a path contain
(s: &str)
| 332 | /// be able to break the copy-pasteable upgrade hint or smuggle |
| 333 | /// expansion into the user's shell. |
| 334 | fn shell_quote(s: &str) -> String { |
| 335 | format!("'{}'", s.replace('\'', "'\\''")) |
| 336 | } |
| 337 | |
| 338 | /// Render an `ATOMIC_INSTALL=...` value suitable for embedding in a shell |
| 339 | /// snippet. When the directory equals `$HOME/.local/bin` literally we |
no outgoing calls
no test coverage detected