Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Sources/SwiftCLI/CompletionGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down