MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / shell_quote

Function shell_quote

atomic-cli/src/commands/update.rs:334–336  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

332/// be able to break the copy-pasteable upgrade hint or smuggle
333/// expansion into the user's shell.
334fn 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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected