diff --git a/internal/action/completion.go b/internal/action/completion.go index 2d4c99fa63..7779c26ddf 100644 --- a/internal/action/completion.go +++ b/internal/action/completion.go @@ -14,7 +14,7 @@ import ( "github.com/urfave/cli/v2" ) -var escapeRegExp = regexp.MustCompile(`(\s|\(|\)|\<|\>|\&|\;|\#|\\|\||\*|\?)`) +var escapeRegExp = regexp.MustCompile(`('|"|\s|\(|\)|\<|\>|\&|\;|\#|\\|\||\*|\?)`) // bashEscape Escape special characters with `\`. func bashEscape(s string) string { @@ -22,6 +22,12 @@ func bashEscape(s string) string { if c == `\` { return `\\\\` } + if c == `'` { + return `\` + c + } + if c == `"` { + return `\\\` + c + } return `\\` + c }) }