m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00
This commit is contained in:
Junegunn Choi
2024-05-14 01:30:36 +09:00
parent 4e9e842aa4
commit 6432f00f0d
7 changed files with 16 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"sync/atomic"
"syscall"
@@ -20,6 +21,8 @@ const (
shellTypePowerShell
)
var escapeRegex = regexp.MustCompile(`[&|<>()^%!"]`)
type Executor struct {
shell string
shellType shellType
@@ -131,7 +134,9 @@ func escapeArg(s string) string {
b = append(b, '\\')
}
b = append(b, '"')
return string(b)
return escapeRegex.ReplaceAllStringFunc(string(b), func(match string) string {
return "^" + match
})
}
func (x *Executor) QuoteEntry(entry string) string {