Sha256: c6b7b859076b7c789813ae78376bf131b54a15833d597f96370d81fbaa91849b

Contents?: true

Size: 1.06 KB

Versions: 87

Compression:

Stored size: 1.06 KB

Contents

// +build windows

package fzf

import (
	"os"
	"regexp"
	"strings"
)

func notifyOnResize(resizeChan chan<- os.Signal) {
	// TODO
}

func notifyStop(p *os.Process) {
	// NOOP
}

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) + "'"
	}
}

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
doing-2.1.88 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.87 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.86 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.85 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.84 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.83 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.82 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.81 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.80 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.79 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.78 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.77 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.76 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.75 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.74 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.73 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.72 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.69 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.68 lib/helpers/fzf/src/terminal_windows.go
doing-2.1.66 lib/helpers/fzf/src/terminal_windows.go