diff --git a/Sources/SwiftCLI/CompletionGenerator.swift b/Sources/SwiftCLI/CompletionGenerator.swift index fb07e99..62e97f2 100644 --- a/Sources/SwiftCLI/CompletionGenerator.swift +++ b/Sources/SwiftCLI/CompletionGenerator.swift @@ -241,7 +241,12 @@ public final class ZshCompletionGenerator: CompletionGenerator { } private func escapeDescription(_ description: String) -> String { - return description.replacingOccurrences(of: "\"", with: "\\\"") + // @see `man bash` and search for "Enclosing characters in double quotes" + return description + .replacingOccurrences(of: #"\"#, with: #"\\"#) + .replacingOccurrences(of: "\"", with: "\\\"") // (") -> (\") + .replacingOccurrences(of: #"`"#, with: #"\`"#) + .replacingOccurrences(of: #"$"#, with: #"\$"#) } private func functionName(for routable: RoutablePath) -> String {