pub fn escape_for_shell(s: &str) -> StringExpand description
Escapes a string for safe use in single-quoted shell contexts.
Replaces single quotes with the pattern '"'"' which:
- Ends the current single-quoted string
- Adds an escaped single quote
- Starts a new single-quoted string
This is the standard POSIX-compliant method for escaping single quotes within single-quoted strings.
ยงExamples
use ssh_mcp::ssh::elevation::escape_for_shell;
assert_eq!(escape_for_shell("hello"), "hello");
assert_eq!(escape_for_shell("it's"), "it'\"'\"'s");
assert_eq!(escape_for_shell("a'b'c"), "a'\"'\"'b'\"'\"'c");