From a4391aeedd4fec1865d2d646711f58d04058531b Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 27 Apr 2024 18:36:37 +0900 Subject: Add --with-shell for shelling out with different command and flags (#3746) Close #3732 --- src/terminal_windows.go | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src/terminal_windows.go') diff --git a/src/terminal_windows.go b/src/terminal_windows.go index a1ea7a22..112cd68d 100644 --- a/src/terminal_windows.go +++ b/src/terminal_windows.go @@ -4,8 +4,6 @@ package fzf import ( "os" - "regexp" - "strings" ) func notifyOnResize(resizeChan chan<- os.Signal) { @@ -19,27 +17,3 @@ func notifyStop(p *os.Process) { func notifyOnCont(resizeChan chan<- os.Signal) { // NOOP } - -func quoteEntry(entry string) string { - shell := os.Getenv("SHELL") - if len(shell) == 0 { - shell = "cmd" - } - - if strings.Contains(shell, "cmd") { - // backslash escaping is done here for applications - // (see ripgrep test case in terminal_test.go#TestWindowsCommands) - escaped := strings.Replace(entry, `\`, `\\`, -1) - escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"` - // caret is the escape character for cmd shell - r, _ := regexp.Compile(`[&|<>()@^%!"]`) - return r.ReplaceAllStringFunc(escaped, func(match string) string { - return "^" + match - }) - } else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") { - escaped := strings.Replace(entry, `"`, `\"`, -1) - return "'" + strings.Replace(escaped, "'", "''", -1) + "'" - } else { - return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'" - } -} -- cgit v1.2.3