mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Fix tests
This commit is contained in:
parent
9619d3447f
commit
1e50764b4d
6 changed files with 109 additions and 25 deletions
|
@ -26,7 +26,6 @@ type Platform struct {
|
|||
OS string
|
||||
Shell string
|
||||
ShellArg string
|
||||
EscapedQuote string
|
||||
OpenCommand string
|
||||
OpenLinkCommand string
|
||||
}
|
||||
|
@ -334,12 +333,15 @@ func (c *OSCommand) PrepareShellSubProcess(command string) *exec.Cmd {
|
|||
|
||||
// Quote wraps a message in platform-specific quotation marks
|
||||
func (c *OSCommand) Quote(message string) string {
|
||||
var quote string
|
||||
if c.Platform.OS == "windows" {
|
||||
quote = `\"`
|
||||
message = strings.NewReplacer(
|
||||
`"`, `"'"'"`,
|
||||
`\"`, `\\"`,
|
||||
).Replace(message)
|
||||
} else {
|
||||
quote = `"`
|
||||
message = strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`"`, `\"`,
|
||||
|
@ -347,8 +349,7 @@ func (c *OSCommand) Quote(message string) string {
|
|||
"`", "\\`",
|
||||
).Replace(message)
|
||||
}
|
||||
escapedQuote := c.Platform.EscapedQuote
|
||||
return escapedQuote + message + escapedQuote
|
||||
return quote + message + quote
|
||||
}
|
||||
|
||||
// AppendLineToFile adds a new line in file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue