Skip to content

Commit

Permalink
zsh: remove backslash from results
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Mar 29, 2023
1 parent cf50c41 commit c262bc1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/actions/bridge/zsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,33 @@ func ActionZsh(command ...string) carapace.Action {
return carapace.ActionExecCommand("zsh", args...)(func(output []byte) carapace.Action {
lines := strings.Split(string(output), "\r\n")
vals := make([]string, 0)

var unquoter = strings.NewReplacer(
`\\`, `\`,
`\&`, `&`,
`\<`, `<`,
`\>`, `>`,
"\\`", "`",
`\'`, `'`,
`\"`, `"`,
`\{`, `{`,
`\}`, `}`,
`\$`, `$`,
`\#`, `#`,
`\|`, `|`,
`\?`, `?`,
`\(`, `(`,
`\)`, `)`,
`\;`, `;`,
`\ `, ` `,
`\[`, `[`,
`\]`, `]`,
`\*`, `*`,
`\~`, `~`,
)

for _, line := range lines[:len(lines)-1] {
line = unquoter.Replace(line)
if splitted := strings.SplitN(line, " -- ", 2); len(splitted) == 1 {
vals = append(vals, splitted[0], "")
} else {
Expand Down

0 comments on commit c262bc1

Please sign in to comment.