blob: c37ef74bfa299360c3799cb2d9adde400d4d62b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
extension Ghostty {
struct Shell {
// Characters to escape in the shell.
static let escapeCharacters = "\\ ()[]{}<>\"'`!#$&;|*?\t"
/// Escape shell-sensitive characters in string.
static func escape(_ str: String) -> String {
var result = str
for char in escapeCharacters {
result = result.replacingOccurrences(
of: String(char),
with: "\\\(char)"
)
}
return result
}
}
}
|